Basic usage¶
Load / Dump the motion¶
Loading and dumping is easy:
int main() {
auto motion = flom::Motion::load("file.fom");
// ... Edit loaded motion
motion.dump("out.fom");
}
We recommend to use .fom
as a file extension.
You can use Motion::load_json
or Motion::dump_json
if you like json
Obtain a frame¶
Use Motion::frame_at
to obtain a frame at arbitrary time point. For example:
// Assume motion is an instance of flom::Motion
auto frame = motion.frame_at(1.5);
Here, frame
is a frame at 1.5 second since the motion is started.
Iterate over frames¶
for (auto&& [t, frame] : motion.frames(10)) {
// Do something with frame
}
In this way, frames are iterated in 10fps(not actual time, but the time in the motion!).
Also t
holds the time of current frame.