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

fairy-anims

v1.3.1

Published

Library that adds dynamically generated animations. # Animations ## Fireflies Fills the element(s) of the specified class with fireflies that have a random flight path.

Downloads

54

Readme

Description

Library that adds dynamically generated animations.

Animations

Fireflies

Fills the element(s) of the specified class with fireflies that have a random flight path.

The function spawnBugs() takes the number of fireflies (as number) and the name of the html-element class (as string)

You are free to use this library both in vanilla JS (TS) and with React

Vanilla example:

	import { spawnBugs } from 'fairy-anims/src';

	spawnBugs(10, 'bug_container');

React example:

	import { FC } from 'react';
	import { spawnBugs } from 'fairy-anims/src';

	const Swarm: FC = () => {
		useEffect(() => {
			spawnBugs(10, 'bug_container')
		}, [])

		return(
			<div className="parent_element">
				<div className="bug_container" />
			<div>
		)
	}

Also, for correct display, the parent element must have such CSS styles:

	.bug_container {
		position: relative;
		overflow: hidden; //Recomended
	}

And also place the container with fireflies at the same level of nesting in the DOM tree with the element needed to fill. In addition, the parent element must not have the following CSS styles to avoid rendering issues:

	.parent_element {
		justify-content: center;
		align-items: center;
	}

Preview Fireflies

Sparks

Fills the element(s) of the specified class with sparks.

The function spawnSparks() takes the number of sparks (as number) and the name of the html-element class (as string)

You are free to use this library both in vanilla JS (TS) and with React

Vanilla example:

	import { spawnSparks } from 'fairy-anims/src';

	spawnSparks(10, 'spark_container');

React example:

	import { FC } from 'react';
	import { spawnSparks } from 'fairy-anims/src';

	const WitchBurning: FC = () => {
		useEffect(() => {
			spawnSparks(10, 'spark_container')
		}, [])

		return(
			<div className="parent_element">
				<div className="spark_container" />
			<div>
		)
	}

Also, for correct display, the parent element must have such CSS styles:

	.spark_container {
		position: relative;
		overflow: hidden; //Recomended
	}

And also place the container with fireflies at the same level of nesting in the DOM tree with the element needed to fill. In addition, the parent element must not have the following CSS styles to avoid rendering issues:

	.parent_element {
		justify-content: center;
		align-items: center;
	}

Preview Sparks

Lines

Fills the screen with lines floating in different directions.

The function runningLines() takes:

  1. Array of strings (string[])
  2. the number of lines (as number);
  3. the name of the html-element class (as string);
  4. options:
    {
    	shadow: boolean; //drop shadow
    	repeat: boolean; //repeat animation or play once
    	speedRange: [number, number]; //time of animation in ms
    	fontSizeRange: [number, number]; //in rem
    	color: string; //font color
    	lineDirection: 'any'; //direction of line movement ('any', 'horizontal', 'vertical')
    }

You are free to use this library both in vanilla JS (TS) and with React

Vanilla example:

	import { runningLines } from 'fairy-anims/src';

	const options = {
		shadow: true; //drop shadow
		repeat: true; //repeat animation or play once
		speedRange: [2000, 4000]; //time of animation in ms
		fontSizeRange: [1, 2.5]; //in rem
		color: '#fff'; //font color
		lineDirection: 'any'; //direction of line movement ('any', 'horizontal', 'vertical')
	}

	runningLines(['hello', 'world'], 10, 'lines_container', options);

React example:

	import { FC } from 'react';
	import { runningLines } from 'fairy-anims/src';

	const RunningLines: FC = () => {

		const options = {
			shadow: true; //drop shadow
			repeat: true; //repeat animation or play once
			speedRange: [2000, 4000]; //time of animation in ms
			fontSizeRange: [1, 2.5]; //in rem
			color: '#fff'; //font color
			lineDirection: 'any'; //direction of line movement ('any', 'horizontal', 'vertical')
		}

		useEffect(() => {
			runningLines(['hello', 'world'], 10, 'lines_container', options)
		}, [])

		return(
			<div className="parent_element">
				<div className="lines_container" />
			<div>
		)
	}

Also, for correct display, the parent element must have such CSS styles:

	.lines_container {
		position: relative;
		overflow: hidden; //Recomended
	}

And also place the container with fireflies at the same level of nesting in the DOM tree with the element needed to fill. In addition, the parent element must not have the following CSS styles to avoid rendering issues:

	.parent_element {
		justify-content: center;
		align-items: center;
	}

Preview Sparks

Stars

Fills the screen with shining stars. You can use it as a background.

The function setSky() takes:

  1. the number of stars (as number);
  2. the name of the html-element class (as string);
  3. options:
    {
    	starsColor: string; //Color of stars
    	starsSizeRange: [number, number]; //size range in px
    	starsShiningSpeedRange: [number, number]; //range of animation time in ms
    }

You are free to use this library both in vanilla JS (TS) and with React

Vanilla example:

	import { setSky } from 'fairy-anims/src';

	const options = {
		starsColor: '#fff'; //Color of stars
		starsSizeRange: [1, 3]; //size range in px
		starsShiningSpeedRange: [1000, 2000]; //range of animation time in ms
	}

	setSky(500, 'sky', options);

React example:

	import { FC } from 'react';
	import { setSky } from 'fairy-anims/src';

	const setSky: FC = () => {

		const options = {
			starsColor: '#fff'; //Color of stars
			starsSizeRange: [1, 3]; //size range in px
			starsShiningSpeedRange: [1000, 2000]; //range of animation time in ms
		}

		useEffect(() => {
			setSky(500, 'sky', options)
		}, [])

		return(
			<div className="parent_element">
				<div className="sky" />
			<div>
		)
	}

Also, for correct display, the parent element must have such CSS styles:

	.lines_container {
		position: relative;
		overflow: hidden; //Recomended
	}

And also place the container with fireflies at the same level of nesting in the DOM tree with the element needed to fill. In addition, the parent element must not have the following CSS styles to avoid rendering issues:

	.parent_element {
		justify-content: center;
		align-items: center;
	}

Preview Sparks