animatePaper.js
an animation library for paper.js
How to use
// Move an Item. Click on the circle on the right
circle.onClick = function() {
this.animate({
properties: {
position: {
x: "+150"
}
},
settings: {
duration: 500,
easing: "swing"
}
});
};
// Use a predefined animation: 'splash'. Click on the button on the right
animatePaper.fx.splash(mySquare,{
complete: function() {
// complete callback
}
});
So far, supported properties are:
opacity
position
scale
rotate
translate
fillColor
strokeColor
Available buit-in "effects":
shake
fadeIn
fadeOut
slideUp
slideDown
splash
Description
This library provides animation helpers for objects created with paper.js.
The API has 3 layers:
- Built-in effects available through
animatePaper.fx
: a collection of one-liners to animate objects. e.g:animatePaper.fx.fadeIn(myCircle);
- Property animation through
animatePaper.animate()
orItem.prototype.animate()
: this method can be used to change the value of one or more properties of anItem
based on a desired value, a duration and an easing algorithm. - Hooks provide a simple way to extend the library to suit your needs. If you want to add an effect or change the behavior of an existing one, you can do so by adding properties to
animatePaper.fx
; if you want to add an easing algorithm, you can do so withanimatePaper.extendEasing()
; to change or add property hooks, useanimatePaper.extendPropHooks()
.
Advanced usage
work in progress!