Animator-Library for Processing
Animator-Library
About
The animator library is a library to make time based anmations in processing. Animator objects can be used to animate values over a timespan using a animation function currently supported are Linear-, Square-, or Squareroot-Animators.
Download
Installation
To install the library download the zipfile, and unzip it in the library folder of your sketchbook-folder
Documentation
An animator interpolates a value starting from a startvalue to a stopvalue over a given timespan
A linear animator can be defined like this
Animator a = new LinearAnimator( time, startvalue, stopvalue );
where time is a long value defining the time in ms
startvalue and stopvalue are floats.
to start the animation
a.start();
is called
the current value of the animator can be fetched using
float v = a.get();
This can be used for example to move an object from a start to an endpoint, change it's color, size, rotation etc
Currently 3 types of animator are implemented
- LinearAnimator - interpolates the value using a linear function
- SquareAnimator - interpolates the value using a square function
- RootAnimator - interpolates the value using a squareroot function
A 4th class that implements the Animator interface is the Delay object which simply pauses for the given amount of time and always returns the same value this is only usefull in combination with Sequences.
Animators can also be added to a Sequence object
Sequence s = new Sequence();
s.addAnimator( new LinearAnimator( 500,100,200 ));
s.addAnimator( new SquareAnimator( 200, 200, 100 ));
the sequence can be started using s.start() and the value is fetched using s.get()
A simpler form of defining sequences is to use the string-parser
the same Sequence as above can be defined using
Sequence s = Sequence.parse( "S100,L500->200,Q200->100");
The animators are separated with a comma, each block starts with a letter and one or two parameter
- "S" is the start value
- "L" defines a LinearAnimator the first integer defines the time the second one the target value
- "Q" defines a SquareAnimator the first integer defines the time the second one the target value
- "R" defines a RootAnimator the first integer defines the time the second one the target value
- "D" defines a Delay in milliseconds
Examples
some simple examples that moves some ellipses from left to right is included in the library and should show up in the examples menu after installing the library.
Licence
ical4p is released under the GNU LGPL