npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

animalclicks

v1.0.0

Published

This is an npm package for adding animal effects to their clicks in their website.

Downloads

9

Readme

AnimalClicks

This is an npm package for adding animal effects to their clicks in their website. AnimalClicks

Constructor

This is a singleton class, one instance of the class will be existing at all time.

constructor(innerText  = ['🦝'],
			time  =  2000,
			quality  =  1,
			angle  =  0,
			velocityX  =  0,
			velocityY  =  0,
			gravity  =  0.075,
			dx  =  10,
			dy  =  10,
			effects  = { random:  true, physics:  true, fade:  true, hideCursor:  true },
			fontSize  =  '24px')
  • innerText: An array containing the characters or emojis that you want to use as the cursor's text. The cursor will switch between these as the text drops. Default is ['🦝'].

  • time: Duration in milliseconds for how long each text element remains visible before disappearing. If effects.fade is set to true, this value will be ignored since fading will handle the lifespan. Default is 2000 milliseconds.

  • quality: Controls the density of the text drops. Higher values mean more text elements will be generated per drop. Default is 1.

  • angle: The maximum random angle at which the text elements can rotate as they fall. A value of 0 means no rotation. Default is 0.

  • velocityX: The upper limit of the horizontal velocity (left/right movement) for each dropped text element. A higher value results in more spread horizontally. Default is 0.

  • velocityY: The upper limit of the vertical velocity (up/down movement) for each dropped text element. This affects how quickly the text falls. Default is 0.

  • gravity: Controls the rate of acceleration downward for each text element. Higher values simulate a stronger gravitational pull, making the elements fall faster. Default is 0.075.

  • dx: The horizontal offset applied to the starting position of each new text element. This is useful for positioning them relative to the cursor or click location. Default is 10.

  • dy: The vertical offset applied to the starting position of each new text element, influencing how far above or below the cursor or click location the text starts. Default is 10.

  • effects: An object that enables or disables specific effects:

    • random: If true, the innerText array will be randomized, picking a random element each time a text is dropped.
      Default: true.

    • physics: If true, physics effects like gravity and velocity will be applied to the text elements, giving them a falling motion.
      Default: true.

    • fade: If true, text elements will gradually fade out instead of disappearing suddenly when their time runs out.
      Default: true.

    • hideCursor: If true, hides the default cursor when the effect is active, allowing the dropped text to act as the cursor replacement.
      Default: true.

  • fontSize: Specifies the font size of the text elements, determining how large or small they appear on the screen. Default is '24px'.

How to update:

By creating a new class

let  animalClicksInstance:  AnimalClicks  =  null;
animalClicksInstance  =  new  AnimalClicks(	innerText,
											time,
											quality,
											angle,
											velocityX,
											velocityY,
											gravity,
											dx,
											dy,
											effects);

By calling update

AnimalClicks.instance.update({  innerText,
								time,
								quality,
								angle,
								velocityX,
								velocityY,
								gravity,
								dx,
								dy,
								effects,
								fontSize});

Usage:

React.js, TypeScript, JavaScript

  1. Import Library (You might need to add @ts-ignore)
//@ts-ignore
import  AnimalClicks  from  './index.js';
  1. Define class
new AnimalClicks(['🦝'],
    2000, 1, 180, 2.5, 4.5, 0.075, 10, 10,
    {
    random: false,
    physics: true,
    fade: true,
    hideCursor: true
	},
	'24px'
);

HTML 3. Define class in index.js first

new AnimalClicks(['🦝'],
    2000, 1, 180, 2.5, 4.5, 0.075, 10, 10,
    {
    random: false,
    physics: true,
    fade: true,
    hideCursor: true
	},
	'24px'
);
  1. Embed JavaScript
<script src="index.js"/>