Skip to content

ffunatsu/ofxTimelineLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

  • For easy use of ofxTimeline as an editor, I'll recommend loaf_timeline. It can be used like Love2D, even without oF.

Dependencies

Examples

NOTE: This is just ofxEasing tester, but useful.

screenshot_easing_tester

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))

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));

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

Dev notes

  • ⚠️ Portation from timeline_rs was mostly done with GitHub Copilot. Already tested, but use with care.

License

WTFPL or 0BSD

About

Data loader for ofxTimeline but also provide scriptable interface

Topics

Resources

License

0BSD, WTFPL licenses found

Licenses found

0BSD
LICENSE_0BSD
WTFPL
LICENSE_WTFPL

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors