SceneTransition
Abstract base class for scene transitions.
A scene transition composites two scenes during an overlap period,
creating visual effects like fades, wipes, slides, etc.
Subclasses must implement the composite method which receives:
- The outgoing scene (scene_out) and its current time
- The incoming scene (scene_in) and its current time
- A progress value (0.0-1.0) within the transition
- A render context with dimensions and settings
Attributes:
duration: Duration of the transition as fraction of total sequence time
easing: Easing function applied to the progress value
overlapping: If True, scenes continue animating during the transition
Constructor
SceneTransition(
duration: float = 0.5,
easing: Callable[[float], float] = <function linear at 0x110340c20>,
overlapping: bool = False
) -> None
Initialize a scene transition.
Parameters
-
duration - Duration of the transition (0.0-1.0 of total sequence time)
-
easing - Easing function to apply to progress (default: linear)
-
overlapping - If True, scenes continue animating during the transition. If False (default), transition blends scene_out at t=1.0 with scene_in at t=0.0.
-
Raises -
ValueError - If duration is not positive
Methods
composite
composite(
scene_out: 'VScene',
scene_in: 'VScene',
progress: float,
time_out: float,
time_in: float,
ctx: RenderContext
) -> Drawing
Composite two scenes during a transition.
Parameters
-
scene_out - The outgoing scene (transitioning away)
-
scene_in - The incoming scene (transitioning in)
-
progress - Progress through the transition (0.0-1.0), already eased
-
time_out - Current time within the outgoing scene (0.0-1.0)
-
time_in - Current time within the incoming scene (0.0-1.0)
-
ctx - Render context with dimensions and settings
Returns
A drawsvg Drawing containing the composited result