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

element-animation

v1.0.1

Published

Prop actions for example falling snow or leaves or just moving props or elements with mousemove in pure javascript.

Downloads

64

Readme

NPM Downloads NPM Github Code Size GitHub License

element-animation

What is this project for?

You can use this project to create congratulation confetti, snow or leaves falling from top to bottom or moved by mouse. Also elements insider your hole document can be moved by mouse movement. With this project you can create awesome effects on your website.

Start with a simple test file to see what the project can do without coding yourself. First you need to download the project and then go to the TEST folder and preview the bootstrap html file.

Documentation

Get started

To start with the project element-animation you need to install via NPM and then import it.

npm i element-animation
import elementAnimation from element-animation

var elemAnim = new elementAnimation(
    container,
    props,
    options
)

container -> DOMElement (default: null)
props -> Array (default: [])
options -> Object (default: {})

Before we start to define the variables you need to know that you only need container and props when using the functions rain(), mousemove() and rainWithMousemove(). First we start with the container. Here you need to give a DOMElement for example a simple <div></div> container.

<div id="element-animation"></div>
const container = document.getElementById('element-animation')

Then you need to define props. There you give an array with the sources to the images like .jpg or .svg.

props = [
    'src_to_img',
    'src_to_img_1'
]

For the options you have the following possibilities. When a comment is behind a option it means that the option is only for a specific funtion.

options = {
    interval: 550,          // rain
    rotate: [-40, 40],
    size: [10, 15],
    duration: [5, 13],      // rain
    amount: [30, 40]        // mousemove
}

Now you need to call one of the given functions described down below to visially see the animation. Choose between rain(), mousemove(), rainWithMousemove() and a special function mousemoveElements().

Functions

All functions except mousemoveElements() need a container for the generated elements.

rain()

new elementAnimation(container, props, options).rain()

mousemove()

new elementAnimation(container, props, options).mousemove()

rainWithMousemove()

new elementAnimation(container, props, options).rainWithMousemove()

mousemoveElements()

data-p-element -> Defines that it is a element for movement data-p-move -> Factor from 0 to unlimited (float with dots allowed)

<div data-ea-element data-ea-move="0.5">
    Example text or element here.
</div>

<div data-ea-element data-ea-move="0.8">
    Secound example text or element here.
</div>
new elementAnimation(container, props, options).mousemoveElements()

Helpers

reset()

Can be used to reset all prop actions. After a reset you can call another functions

const elemAnim = new elementAnimation(container, props, options).rain()

elemAnim.reset()
elemAnim.mousemove()

Changelog

Please see CHANGELOG for more information what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.