movis.ops.switch#
- movis.ops.switch(layers: Sequence[BasicLayer], start_times: Sequence[float], cams: Sequence[int], size: tuple[int, int] | None = None, duration: float | None = None) Composition [source]#
Switch layers at specified times.
- Args:
- layers:
Layers to switch.
- start_times:
Start times of the intervals.
- cams:
Scene numbers of the intervals.
- size:
Size of the composition. If
None
, the size of the layer is estimated.- duration:
Duration of the composition. If
None
, the duration is estimated.
- Returns:
Composition with the layer switched.
- Examples:
>>> import movis as mv >>> layer1 = mv.layer.Image("image1.png", duration=5.0) >>> layer2 = mv.layer.Image("image2.png", duration=5.0) >>> # Show layer1 at 0.0-2.0 and layer2 at 2.0-5.0 >>> composition = mv.switch([layer1, layer2], [0.0, 2.0], [0, 1]) >>> composition.duration 5.0