Frame Quantization
To ensure animations and media are perfectly synchronized, ef-timegroup quantizes all time values to a consistent frame grid. This eliminates floating-point drift and guarantees deterministic output — the same currentTime value always produces the same frame in both preview and final render.
The problem with raw floating-point time
- Precision errors. Values like
1.234567890123do not align with frame boundaries. Errors accumulate over long timelines. - Frame misalignment. Setting
currentTime = 1.234might land between two frames, causing different elements to interpret the same time value differently. - Non-deterministic seeking. Seeking to the same logical time twice might land on different frames, making frame state unpredictable.
How quantization works
All time values are snapped to the nearest frame boundary based on the configured fps:
quantized_time = round(time × fps) / fps
With fps = 30, setting currentTime = 1.234 quantizes to frame 37:
round(1.234 × 30) / 30 = 37 / 30 = 1.2333...s
The same value always resolves to the same frame, and playback and rendering always agree on what that frame looks like.
const tg = document.getElementById('my-video');tg.fps = 30;tg.currentTime = 1.234; // automatically quantized to 1.2333...s (frame 37)
Constraint: Set fps once on the root timegroup. Do not set different values on nested children — mismatched FPS values inside a tree cause quantization disagreements where parent and child disagree on which frame they are on.
Frame-Perfect Sync
FPS: 30