animatePaper.js

an animation library for paper.js
You need canvas support to see this demo

You can get animatePaper.js on npm : npm install --save paper-animate, using bower: bower install paper-animate --save or get the latest release on Github

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:

  1. Built-in effects available through animatePaper.fx: a collection of one-liners to animate objects. e.g: animatePaper.fx.fadeIn(myCircle);
  2. Property animation through animatePaper.animate() or Item.prototype.animate(): this method can be used to change the value of one or more properties of an Item based on a desired value, a duration and an easing algorithm.
  3. 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 with animatePaper.extendEasing(); to change or add property hooks, use animatePaper.extendPropHooks().
For more information, please read the readme.md file of the repo and/or the full documentation.

Advanced usage

work in progress!
Fork me on GitHub