flambe
flambe copied to clipboard
Flump frame label support
It should be possible to go to a frame label, and listen when a label is crossed.
Has anyone made a start on this or thought about it any more? I'd like to help add this feature.
That would be a big help, Mike! I haven't started it, but I was thinking it should look something like:
- A
labelPassed :Signal<String>
on MovieSprite that gets emitted during an update when a label is crossed. Useful for letting artists insert "points of interest" that the coder can hook up to do different things (like playing sound effects in sync with the movie) - A
findLabel(name :String) :Float
on MovieSymbol, for looking up the time position of a label, or -1 if it doesn't exist. - A way to enumerate all the labels on MovieSymbol?
Ok, that sounds good to me. I'll have a crack at it!
Could I change the frame index to an Int? Hmm, I guess it's needed somewhere for frame interpolation when playing at different rates though...
Perhaps when fetching a position based on a frame-label you should only be given the frame index as an Int - labels will always be on whole-frames I suppose. It could then use a Map<String,Int> for labels and frame indices to make lookups pretty straightforward after the map is populated. That would also make finding when a frame label is passed pretty straightforward.
Since Flump uses named layers for movies, I though we could specify to use a layer named 'labels', specifically for frame-labels. I checked that Flump exports empty layers that have labels on keyframes, it does and Flame parses them fine. But I'm not sure if that's a particular waste of resources internally for Flambe to have movie layers with no symbols, or if they are just ignored as far as display is concerned.
Made a start...
https://github.com/mikedotalmond/flambe/commit/e2b8b4c5ffe6b844a1817ee79b2deeae4f2e1bd2
It works for me on a minimal test with a few animations and frame labels, but it definitely needs a bit more testing :)