ofxTweener
ofxTweener is the missing tween class for open frameworks. It's implementation is much like AS3's Tweener and TweenMax. It uses a single, static tweenclass that controls all tweens using references. That means that there's no need to update the individual vars.
Features
- single static class One tween class to control them all
- central update() function can be called from within the draw function for visual sync tweening
- reference variables no need to update
- delays
- central time scaling
- stop/remove all or individual tweens
- override or sequence mode
- bezier tweening
ofxTweener
ofxTweener works with OF 0.06 and 0.07. It has been tested on OSX 10.6~7 and Windows as well. The included example is a Xcode 4 OF 0.07 project.
Example Code
// simple fast implementation
Tweener.addTween(position.x, ofRandom(1024), 5);
Tweener.addTween(position.y, ofRandom(768), 5);
// custom ease
Tweener.addTween(position.x, ofRandom(1024), 5, &ofxTransitions::easeOutElastic);
Tweener.addTween(position.y, ofRandom(768), 5, &ofxTransitions::easeOutElastic);
// adding delay
Tweener.addTween(position.x, ofRandom(1024), 5, &ofxTransitions::easeOutElastic, 1);
Tweener.addTween(position.y, ofRandom(768), 5, &ofxTransitions::easeOutElastic, 0.5);
// bezier tweening
Tweener.addTween(position.x, ofRandom(1024), 1, &ofxTransitions::easeOutCubic, 0, 1024/2);
Tweener.addTween(position.y, ofRandom(768), 1, &ofxTransitions::easeOutCubic, 0, 768/2);
Download
The source code is available for download at GitHub, here:
ofxTweener