ofxCinderTimeline is Cinder's
Timeline animation engine packaged as an openFrameworks addon. The
Timeline API allows for the sophisticated animation of arbitrary properties. It supports a large library of easing functions as well as custom easing, callbacks and fire-and-forget tween management. The add source is taken directly from Cinder 0.8.4 and unmodified (newer versions require not-yet-supported-by-openFrameworks
Timeline is based on the sc-Choreograph CinderBlock by David Wicks.
Basics - Take
pos to (0,0) in 1 second using a quadratic easing curve. 0.125 seconds before the
pos animation completes, begin to take
radius to 3.0 in 5 seconds using the default linear easing.
ofxCinderTimeline::Anim<ofVec2f> pos = ofVec2f(10.0f, 10.0f); ofxCinderTimeline::Anim<float> radius = 0.0f; timeline().apply(&pos, ofVec2f::zero(), 1.0f, ofxCinderTimeline::EaseInQuad()); timeline().apply(&radius, 3.0f, 5.0f).appendTo(&pos, -0.125f);
Callbacks - After a 4 second delay, animate
alpha from 1.0 to 0.0 in 2 seconds using the default linear easing. When complete, the callback method
faded will be run.
ofxCinderTimeline::Anim<float> alpha; timeline().apply(&alpha, 1.0f, 0.0f, 2.0f).delay(4.0f).finishFn(boost::bind(&ofApp::faded, this));
Cues - 5 seconds from now, run the callback method
timeline().add(boost::bind(&ofApp::cueHit, this), timeline().getCurrentTime() + 5);
Timeline requires Boost to compile. Download the 1.48 sources unarchive and move the resulting boost_1_48_0/boost into ofxCinderTimeline/libs. The
ofxCinderTimeline addon requires that ofxCinderTimeline/libs and ofxCinderTimeline/libs/cinder/include are included in the header search path.
While Boost is required, you may not want to add it to your project as there are 8,654 header files - it only needs to be within the header search path! Both the projectGenerator and OFPlugin blow up trying to use
ofxCinderTimeline, possibly due to the number of Boost headers. Until that is resolved, you may wish to add
ofxCinderTimeline to your project manually.