@jkroso/animation

base class for animations

Usage no npm install needed!

<script type="module">
  import jkrosoAnimation from 'https://cdn.skypack.dev/@jkroso/animation';
</script>

README

animation

A base class for animations. Used by move and timeline

Installation

npm install @jkroso/animation

then in your app:

import Animation from 'animation'

API

Animation#duration(n:Number|String)

set duration to n milliseconds. You can also pass a natural language string

animation.duration('1.2s')

Animation#ease(fn:String|Function)

Set easing function to fn.

animation.ease('in-out-sine')

Animation#run([n]:Number|String)

run the animation with an optional duration

animation.run()

Expected extensions

Animation#render(n:Number)

render the animation at point n between its endpoints where n is a number from 0 to 1. Subclasses may also choose to apply the ._ease() function to n within render.

Mover.prototype.render = function(n){
  // apply changes here
}