Class: DomEase

DomEase

Manages all eases

new DomEase (options)

Name Type Description
options object optional
Name Type Default Description
duration number 1000 optional default duration
ease string | function penner.linear optional default ease
autostart string | function true optional
maximumFrameRate number 16.667 optional
pauseOnBlur boolean optional pause timer on blur, resume on focus
Example
var Ease = require('dom-ease');
var ease = new Ease({ duration: 3000, ease: 'easeInOutSine' });

var test = document.getElementById('test')
ease.add(test, { left: 20, top: 15, opacity: 0.25 }, { repeat: true, reverse: true })

Extends

Methods

add (element(s), params, options)Ease | Array.<Ease>

add ease(s) to one or more elements
Name Type Description
element(s) HTMLElement | Array.<HTMLElement>
params object
Name Type Description
left number optional in px
top number optional in px
width number optional in px
height number optional in px
scale number optional
scaleX number optional
scaleY number optional
opacity number optional
marginTop number optional in px
marginRight number optional in px
marginBottom number optional in px
marginLeft number optional in px
color color | Array.<color> optional
backgroundColor color | Array.<color> optional
options object optional
Name Type Description
duration number optional
ease string | function optional
repeat boolean | number optional
reverse boolean optional
Returns:
Type Description
Ease | Array.<Ease> ease(s) for each element

emit (event)Boolean inherited

Calls each of the listeners registered for a given event.
Name Type Description
event String | Symbol The event name.
Returns:
Type Description
Boolean `true` if the event had listeners, else `false`.

eventNames ()Array inherited

Return an array listing the events for which the emitter has registered listeners.
Returns:
Type Description
Array

getCount ()number

number of eases
Returns:
Type Description
number

listenerCount (event)Number inherited

Return the number of listeners listening to a given event.
Name Type Description
event String | Symbol The event name.
Returns:
Type Description
Number The number of listeners.

listeners (event)Array inherited

Return the listeners registered for a given event.
Name Type Description
event String | Symbol The event name.
Returns:
Type Description
Array The registered listeners.

once (event, fn, context)EventEmitter inherited

Add a one-time listener for a given event.
Name Type Default Description
event String | Symbol The event name.
fn function The listener function.
context * this optional The context to invoke the listener with.
Returns:
Type Description
EventEmitter `this`.

on (event, fn, context)EventEmitter inherited

Add a listener for a given event.
Name Type Default Description
event String | Symbol The event name.
fn function The listener function.
context * this optional The context to invoke the listener with.
Returns:
Type Description
EventEmitter `this`.

remove (ease)

remove eases using Ease object returned by add()
Name Type Description
ease Ease

removeAll ()

remove all eases

removeAllListeners (event)EventEmitter inherited

Remove all listeners, or those of the specified event.
Name Type Description
event String | Symbol optional The event name.
Returns:
Type Description
EventEmitter `this`.

removeListener (event, fn, context, once)EventEmitter inherited

Remove the listeners of a given event.
Name Type Description
event String | Symbol The event name.
fn function Only remove the listeners that match this function.
context * Only remove the listeners that have this context.
once Boolean Only remove one-time listeners.
Returns:
Type Description
EventEmitter `this`.

removeObjectEases (element)

remove all eases on element
Name Type Description
element HTMLElement

start ()

start animation loop (automatically called unless options.autostart=false)

stop ()

stop animation loop

update (elapsed)

update frame; this is called automatically if start() is used
Name Type Description
elapsed number time in ms

Events

complete

fires when there are no more animations for a DOM element
Type:
fires on each loop for a DOM element where there are animations
Type: