← Back

ofxTimelineLoader

github.com/ffunatsu/ofxTimelineLoader · @ffunatsu
OF 0.12 Animation Utilities

Data loader for ofxTimeline but also provide scriptable interface

0 0 Last commit 1y ago Created 1y ago

README

ofxTimelineLoader



Data loader for ofxTimeline ( original / my fork ) but also provide scriptable interface (kind of like ofxKeyframeTween). This addon works without ofxTimeline. Using ofxTimeline as an timeline editor is an option.

(C++/oF port of timeline_rs)

Tested with oF v0.12.0.

ofxTimeline as an timeline editor (option)



Dependencies



Examples



Easing Tester



NOTE: This is just ofxEasing tester, but useful.

screenshot_easing_tester

Timeline Simple



Timeline constructing by script.

If you want to use this addon as a standalone lib without ofxTimeline data, this example would be helpful.

screenshot_example_simple

using namespace ofxTimelineLoader;
timeline = std::make_shared<Timeline>();

Track<float> tx;
tx.keyframes.push_back({std::chrono::milliseconds(0), 0.0f, ofxeasing::Function::Cubic, ofxeasing::Type::In});
tx.keyframes.push_back({std::chrono::milliseconds(1000), 1.0f, ofxeasing::Function::Cubic, ofxeasing::Type::Out});
tx.keyframes.push_back({std::chrono::milliseconds(2000), 0.0f, ofxeasing::Function::Cubic, ofxeasing::Type::In});
timeline->add<float>("x", tx);

// ...

x = timeline->get_value<float>("x", std::chrono::milliseconds((int)t_ms))


Timeline From XML



XML parsing example

screenshot_example_simple

std::string xml_x = R"(<keyframes>
<key>
    <easefunc>0</easefunc>
    <easetype>0</easetype>
    <time>00:00:00:524</time>
    <value>0.375000000</value>
</key>
<key>
    <easefunc>4</easefunc>
    <easetype>0</easetype>
    <time>00:00:02:123</time>
    <value>0.330175757</value>
</key>
</keyframes>)";

using namespace ofxTimelineLoader;
timeline = std::make_shared<Timeline>();
timeline->add<float>("x", track_from_xml<float>(xml_x));

// ...

x = timeline->get_value<float>("x", std::chrono::milliseconds((int)t_ms));


:writing_hand: NOTE: You can also parse JSON using track_from_json(const ofJson& json).

Dev notes



License



WTFPL or 0BSD

Get this addon

HTTPS
SSH