zz85 / timeliner

simple javascript timeline library for animation and prototyping
https://twitter.com/blurspline
MIT License
705 stars 123 forks source link

Separate tween updating from GUI #14

Open cocoademon opened 7 years ago

cocoademon commented 7 years ago

Hello,

I'd like to set this up to be able to use it without showing a GUI.

Right now, the tween update happens in LayerView (view_layer.js), in the repaint() function. Most of the interesting stuff is in util.timeAtLayer() though.

I'm not sure which is the best way to separate out the tween engine from the GUI - it doesn't need to be completely separate, but at least there should be an update path.

One simple way is to have LayerView listen to the time.update message, separately to render(), but I'm wary of doing this as there's a TODO comment in view_panel.js saying "// DON'T use time.update for everything".

An alternative is to duplicate the state loading code and tween update logic into a separate, smaller library, which can be swapped out for the full timeliner library. Maybe a separate "timeliner_player.js".

With some careful design, this could be done without actually copying any code around.

Thoughts?

zz85 commented 7 years ago

Thanks for bringing this up. This also shares similar concerns with #9.

I'm thinking that having a separate tween engine is good to have and something not difficult to do. I however probably require more thought on how the engine and gui along with other components would be able to work modularly but in harmony.