Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

animore

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animore

Animore makes DOM state transitions easier

  • 2.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 23 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc