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

animore

v2.0.3

Published

Animore makes DOM state transitions easier

Downloads

11

Readme

animore

Animore makes DOM state transitions easier It uses internally the css transitions to animate 2 different states of the same DOM node. It was inspired by riot-animore and works thanks to the flip technique by Paul Lewis

Build Status NPM version NPM downloads MIT License

Demos

Installation

Via npm

$ npm i animore -S

Script import

Via <script>

<script src="path/to/animore.js"></script>

Via ES2015 modules

import animore from 'animore'

Via commonjs

const animore = require('animore')

Usage

Simple transitions

You can pass a query or a DOM node to animore in the following way:


const animaQuery = animore('.my-div')[0] // animore returns always an array!
const animaNode = animore(myDiv)[0] // DOM nodes are also valid
const animaList = animore([myDiv, myUl]) // an arrays are also valid
const animaNodeList = animore(myUl.children) // NodeLists are valid as well

Remeber to use stash and apply to create your transitions

const anima = animore('.my-div')[0]
anima.stash() // store the previous DOM position
anima.el.style.marginTop = '300px'
anima.apply() // apply the transition

Options

The animore factory function accepts 2 arguments animore(el, options) with the options object you can specify how your animations should behave:

animore(myDiv, {
  duration: 300, // animation duration in ms
  easing: 'ease-in-out', // this should be a valid css easing function
  delay: 20, // animation delay
  onStart: function() { console.log('new animation started ')},
  onCancel: function() { console.log('animation canceled ')},
  onEnd: function() { console.log('animation ended ')}
})

API

Any animore call will return an object with the following properties

animore.stash

Store the current DOM node position and size

@returns self

animore.apply

Apply the transition comparing the current DOM node state with its previous state (it can be called only after a stash)

@returns self

animore.el

Reference to the DOM node queried

@returns HTMLElement