SMPTE Timecodes & Timelines, Sequences and Keyframes. #22
+1,843
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm making this a draft for now, this PR is to document the progress i've been making so far with this experiment.
This experiment can also fail. If you see any kind of flaw, please feel free to point it out.
The final goals of this (if succeeds) are:
Progress.
isize
instead off64
).as_string()
prettier (print out '00:00:00:00' instead of '0:0:0:0').SMPTE Timecodes (Update 2).
SMPTE Timecodes are time units that are set like a clock: HH:MM:SS:FF (Hours, Minutes, Seconds, Frames).
For convenience, there's a macro that helps visualize this concept better in code:
(Sadly, Rust's macros don't allow me to use ":" so i have to use ";" instead, if there's a workaround for this, please let me know)EDIT: I fixed it!
Timecodes can be used as a Timestamp, or as a value for a Timeline, by setting the Framerate:
There's
Framerate::Fixed(n)
andFramerate::Interpolated(n)
. Once Timelines become a thing, fixed framerates will round up to the nearest frame when the tween is calculated, which will be useful for frame-by-frame animations. Interpolated frames on the other hand, will interpolate regardless of the framerate you're running (unless you explicitly set "hold" frames).Timecodes with a framerate can advance and reverse by frames, seconds, minutes, hours and use
Duration
(Instant
coming soon).Example: Play one second frame-by-frame.
Example: Add by Duration.
Example: Sub by Duration.
The draft repository contains more examples in form of tests inside of
lib.rs
.This is all of the progress for now, for any questions, please feel free to ask :)