0.5.0 • Published 2 years ago

css-animation-sync v0.5.0

Weekly downloads
1,602
License
MIT
Repository
github
Last release
2 years ago

css-animation-sync Build Status npm version Dependency Status

Synchronise and control CSS Animations

NOTE: This library was created before the availability of the Web Animations API and this may now provide a better solution for you.

The Problem

When DOM elements styled with the same CCS Animation are added to the document at different times, the animations are out of synchronisation.

ProblemSolution
Elements added at different times are out of syncAdding sync('spinner');
BeforeAfter

Interactive Example

Usage

import sync from 'css-animation-sync';

sync('spinner');

Install

npm install css-animation-sync --save

API

  • const animation = new sync(animationName || animationNames) - Synchronises all DOM elements using a CSS animation or multiple CSS animations. The animations duration needs to be the same for syncing to make sense.

    • animationName Name of the CSS animation to sync
    • animationNames Array of CSS animations to sync (allows syncing multiple animations)
Returns an animation instance (see below)
  • animation.free() - Stops synchronisation of DOM elements using the animation

  • animation.pause() - Pause the animation of DOM elements using the animation

  • animation.stop() - Stop the animation of DOM elements using the animation

  • animation.start() - Start/Resume the animation of DOM elements using the animation

Test

npm install
npm test

Dev

npm start
0.5.0

2 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.4.0-beta-2

3 years ago

0.4.0-beta-1

3 years ago

0.3.0

3 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.0.7

5 years ago

0.0.6

6 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago