VSceneSequence

Sequence of VScenes with transitions between them.

VSceneSequence provides a builder API for combining multiple scenes with animated transitions. It handles time mapping so each scene's internal time (0.0-1.0) is correctly mapped to the sequence timeline. All methods return new instances (immutable pattern).

Constructor

VSceneSequence(
    width: Optional[float] = None,
    height: Optional[float] = None,
    origin: Optional[Origin] = None,
    _entries: Optional[List[Union[_SceneEntry, _TransitionEntry]]] = None
) -> None

Initialize an empty scene sequence.

Parameters

width
Override width (default: use first scene's width)
height
Override height (default: use first scene's height)
origin
Override origin mode (default: use first scene's origin)

Methods

scene

scene(scene: 'VScene', duration: float = 1.0) -> 'VSceneSequence'

Add a scene to the sequence. Returns new VSceneSequence.

Parameters

scene
The VScene to add
duration
Relative duration weight for this scene

Returns

New VSceneSequence with scene added Raises: ValueError: If duration is not positive or if a scene follows another scene without a transition

to_drawing

to_drawing(
    frame_time: float = 0.0,
    render_scale: float = 1.0,
    width: Optional[float] = None,
    height: Optional[float] = None
) -> Drawing

Render the sequence at a specific time point.

Parameters

frame_time
Time point to render (0.0 to 1.0)
render_scale
Scale factor for rendering
width
Unused, for VSceneExporter compatibility
height
Unused, for VSceneExporter compatibility

Returns

A drawsvg Drawing Raises: ValueError: If the sequence is empty or frame_time is invalid

to_svg

to_svg(
    frame_time: float = 0.0,
    render_scale: float = 1.0,
    width: Optional[float] = None,
    height: Optional[float] = None,
    filename: Optional[str] = None,
    log: bool = True
) -> str

Render the sequence to SVG at a specific time point.

Parameters

frame_time
Time point to render (0.0 to 1.0)
render_scale
Scale factor for rendering
width
Unused, for VSceneExporter compatibility
height
Unused, for VSceneExporter compatibility
filename
Optional filename to save SVG to
log
Whether to log the save operation

Returns

SVG string

transition

transition(transition: SceneTransition) -> 'VSceneSequence'

Add a transition between scenes. Returns new VSceneSequence.

Parameters

transition
The SceneTransition to apply

Returns

New VSceneSequence with transition added Raises: ValueError: If no scene has been added yet, or if consecutive transitions are added

Properties

height
Get the sequence height (from first scene or override).
origin
Get the sequence origin mode (from first scene or override).
width
Get the sequence width (from first scene or override).