1.6.8 • Published 3 years ago

yy-animate v1.6.8

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

This library is deprecated. Try its replacement pixi-ease on github or npm. Same functionality, new packaging, better events and easier cleanup.


animate.js

yet another javascript animation library (designed specifically for games and PIXI.js)

Live Example

https://davidfig.github.io/animate/

Installation

npm install yy-animate

API Reference

Classes

Functions

angle

animate object's {x, y} using an angle

Kind: global class

new angle(object, angle, speed, duration, options)

ParamTypeDefaultDescription
objectobjectto animate
anglenumberin radians
speednumberin pixels/millisecond
durationnumber0in milliseconds; if 0, then continues forever
optionsobject@see Wait

face

Rotates an object to face the target

Kind: global class

new face(object, target, speed, options)

ParamTypeDescription
objectobject
targetPoint
speednumberin radians/millisecond
optionsobject@see Wait
options.keepAlivebooleandon't stop animation when complete

movie

animate a movie of textures

Kind: global class
Examples: // animate sprite to (20, 20) over 1s using easeInOuTsine, and then reverse the animation new Animate.movie(sprite, texture1, texture2, texture3, 500);

new movie(object, textures, duration, options)

ParamTypeDefaultDescription
objectobjectto animate
texturesarrayparameters to animate, e.g.: {alpha: 5, scale: {x, 5} rotation: Math.PI}
durationnumber0time to run (use 0 for infinite duration--should only be used with customized easing functions)
optionsobject
options.waitnumber0n milliseconds before starting animation (can also be used to pause animation for a length of time)
options.pausebooleanstart the animation paused
options.repeatboolean | numbertrue: repeat animation forever; n: repeat animation n times
options.reverseboolean | numbertrue: reverse animation (if combined with repeat, then pulse); n: reverse animation n times
options.continueboolean | numbertrue: continue animation with new starting values; n: continue animation n times
options.loadfunctionloads an animation using a .save() object; note the * parameters below cannot be loaded and must be re-set
options.easefunctionfunction from easing.js (see http://easings.net for examples)*
options.rendererRenderersets Renderer.dirty for each loop*
options.onDonefunctionfunction pointer for when the animation expires*
options.onCancelfunctionfunction pointer called after cancelled*
options.onWaitfunctionfunction pointer for wait*
options.onFirstfunctionfunction pointer for first time update is called (does not include pause or wait time)*
options.onEachfunctionfunction pointer called after each update*
options.onLoopfunctionfunction pointer called after a revere, repeat, or continue*

shake

shakes an object or list of objects

Kind: global class

new shake(object, amount, duration, options)

ParamTypeDescription
objectobject | arrayor list of objects to shake
amountnumberto shake
durationnumber(in milliseconds) to shake
optionsobject(see Animate.wait)

target

move an object to a target's location

Kind: global class

new target(object, target, speed, options)

move to a target

ParamTypeDescription
objectobjectobject to animate
targetobjectobject needs to contain {x: x, y: y}
speednumbernumber of pixels to move per millisecond
optionsobject@see Wait
options.keepAlivebooleandon't cancel the animation when target is reached

tint

changes the tint of an object

Kind: global class

new tint(object, tint, duration, options)

ParamTypeDefaultDescription
objectPIXI.DisplayObject | Array.<PIXI.DisplayObject>
tintnumber
durationnumber0in milliseconds, if 0, repeat forever
optionsobject@see Wait

to

animate any numeric parameter of an object or array of objects

Kind: global class
Examples: // animate sprite to (20, 20) over 1s using easeInOuTsine, and then reverse the animation new Animate.to(sprite, {x: 20, y: 20}, 1000, {reverse: true, ease: Easing.easeInOutSine});

// animate list of sprites to a scale over 10s after waiting 1s new Animate.to(sprite1, sprite2, sprite3, {scale: {x: 0.25, y: 0.25}}, 10000, {wait: 1000});

new to(object, goto, duration, options)

ParamTypeDefaultDescription
objectobjectto animate
gotoobjectparameters to animate, e.g.: {alpha: 5, scale: {x, 5} rotation: Math.PI}
durationnumber0time to run (use 0 for infinite duration--should only be used with customized easing functions)
optionsobject
options.waitnumber0n milliseconds before starting animation (can also be used to pause animation for a length of time)
options.pausebooleanstart the animation paused
options.repeatboolean | numbertrue: repeat animation forever; n: repeat animation n times
options.reverseboolean | numbertrue: reverse animation (if combined with repeat, then pulse); n: reverse animation n times
options.continueboolean | numbertrue: continue animation with new starting values; n: continue animation n times
options.orphanbooleandelete animation if .parent of object (or first object in list) is null
options.loadfunctionloads an animation using an .save() object; note the * parameters below cannot be loaded and must be re-set
options.easefunctionfunction from easing.js (see http://easings.net for examples)*
options.rendererRenderersets Renderer.dirty for each loop*
options.onDonefunctionfunction pointer for when the animation expires*
options.onCancelfunctionfunction pointer called after cancelled*
options.onWaitfunctionfunction pointer for wait*
options.onFirstfunctionfunction pointer for first time update is called (does not include pause or wait time)*
options.onEachfunctionfunction pointer called after each update*
options.onLoopfunctionfunction pointer called after a revere, repeat, or continue*

wait

base class for all animations

Kind: global class

new wait(object, options)

ParamTypeDefaultDescription
objectobjectto animate
optionsobject
options.waitnumber0n milliseconds before starting animation (can also be used to pause animation for a length of time)
options.pausebooleanstart the animation paused
options.repeatboolean | numbertrue: repeat animation forever; n: repeat animation n times
options.reverseboolean | numbertrue: reverse animation (if combined with repeat, then pulse); n: reverse animation n times
options.continueboolean | numbertrue: continue animation with new starting values; n: continue animation n times
options.idnumberuser-generated id (e.g., I use it to properly load animations when an object has multiple animations running)
options.orphanbooleandelete animation if .parent of object (or first object in list) is null
options.loadfunctionloads an animation using an .save() object; note the * parameters below cannot be loaded and must be re-set
options.easefunction | stringfunction (or penner function name) from easing.js (see http://easings.net for examples)*
options.rendererRenderersets Renderer.dirty for each loop*
options.onDonefunctionfunction pointer for when the animation expires*
options.onCancelfunctionfunction pointer called after cancelled*
options.onWaitfunctionfunction pointer for wait*
options.onFirstfunctionfunction pointer for first time update is called (does not include pause or wait time)*
options.onEachfunctionfunction pointer called after each update*
options.onLoopfunctionfunction pointer called after a revere, repeat, or continue*

load(object(s), load, options)

restart an animation = require(a saved state

Kind: global function

ParamTypeDescription
object(s)objectto animate (cannot be saved)
loadobjectobject = require(.save()
optionsobjectinclude any additional options that cannot be saved (e.g., onDone function pointer)

Copyright (c) 2016 YOPEY YOPEY LLC - MIT License - Documented by jsdoc-to-markdown

1.6.8

3 years ago

1.6.7

4 years ago

1.6.6

4 years ago

1.6.5

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago