annie.pages.timeline_view¶
Visible-window geometry of the event timeline (pure, no UI).
The timeline shows a window [start, start + span] of the clip’s frames. The window is
state of its own: it never derives from the playhead, so the playhead can travel inside it
(or leave it) while the user pans, zooms, or follows playback. Everything here is plain
arithmetic so the rules are unit-testable without a browser.
Attributes¶
Upper bound on the zoom factor. |
|
Fraction of the window left behind the playhead after a page-flip. |
Classes¶
The visible window of a clip's timeline. |
Module Contents¶
- annie.pages.timeline_view.MAX_ZOOM = 100.0¶
Upper bound on the zoom factor.
- annie.pages.timeline_view.FOLLOW_LEAD = 0.1¶
Fraction of the window left behind the playhead after a page-flip.
- class annie.pages.timeline_view.TimelineView[source]¶
The visible window of a clip’s timeline.
- total_frames¶
Clip length in frames (0 while unknown).
- zoom¶
Zoom factor,
>= 1;1shows the whole clip.
- start¶
First visible frame. Clamped whenever it is read, so it may be set freely.
- property last_frame: int¶
Index of the clip’s last frame (
0for an empty/unknown clip).
- property zoomed_in: bool¶
Whether the window is narrower than the clip (pan/scrollbar make sense).
- property span: int¶
Number of frames between the window’s edges (
>= 1).
- fraction_of(frame: int) float | None[source]¶
Return
frame’s horizontal position[0, 1], orNoneif off-screen.
- fraction_clamped(frame: int) float[source]¶
Return
frame’s position clipped to[0, 1](for bands that clip at an edge).
- zoom_by(factor: float, anchor_frame: int | None = None) None[source]¶
Multiply the zoom, keeping
anchor_frameat the same screen position.- Parameters:
factor – Multiplier (
> 1zooms in).anchor_frame – Frame to hold still;
Noneanchors on the window’s centre. An anchor outside the window is treated likeNone.
- pan_by(delta_frames: int) None[source]¶
Slide the window by
delta_frames(no-op when not zoomed in).
- pan_by_fraction(fraction: float) None[source]¶
Slide the window by a fraction of its own width (negative pans left).
- set_start_fraction(fraction: float) None[source]¶
Place the window’s left edge at
fractionof the pannable range (scrollbar).