Documentation
¶
Overview ¶
Package animclock is the animation scheduler the application loop drives: launched pieces, the frame deadlines the loop wakes on, and the tick that advances them. The public timeline API lives in package anim; only the loop and tests reach this package.
Index ¶
Constants ¶
const FrameInterval = time.Second / 60
FrameInterval is the frame period: the fallback pacing when the compositor's frame callbacks stop arriving, and the deadline granularity of Next while a piece is mid-flight.
Variables ¶
This section is empty.
Functions ¶
func Drive ¶
Drive runs fn once per frame with the frame's instant until it reports false (settled) or the returned cancel runs.
func Launch ¶
func Launch(pieces []Piece) (cancel func())
Launch schedules pieces from the current instant and returns the cancel that stops every piece not yet finished. A piece with no duration and no offset lands at once, outside the schedule.
func Next ¶
Next returns the earliest instant the loop must wake to keep the clock running: one frame past the last tick while a piece is mid-flight, or a later piece's start while a timeline holds in a delay. False means nothing runs and the loop may park.
func SetClock ¶
SetClock replaces the time source launches and deadlines read and returns the restore function; nil restores time.Now.
func Tick ¶
Tick advances every running piece to now and drops finished or cancelled ones. Callbacks run after the pass settles with the lock released, so they may launch or cancel freely; a callback cancelling its own timeline still stops that timeline's later pieces in the same tick. It reports whether any callback ran.