Skip to content

Pan

PanFn module-attribute

PanFn = Callable[
    [float], tuple[float, str] | tuple[str, float]
]

The pan function type.

BasePanEffect

Bases: BaseModel

A pan effect.

zoom_factor class-attribute instance-attribute

zoom_factor: PositiveFloat = 1.1

The zoom factor.

apply

apply(clip: VideoClip) -> VideoClip

Apply the pan effect to the clip.

Parameters:

Name Type Description Default
clip VideoClip

The clip.

required

Returns:

Type Description
VideoClip

The clip with the effect applied.

Source code in src/mosaico/effects/pan.py
def apply(self, clip: VideoClip) -> VideoClip:
    """
    Apply the pan effect to the clip.

    :param clip: The clip.
    :return: The clip with the effect applied.
    """
    pan_fn = self._pan_fn(clip)
    return clip.fx(resize, self.zoom_factor).set_position(pan_fn)

PanRightEffect

Bases: BasePanEffect

A left to right pan effect.

type class-attribute instance-attribute

type: Literal['pan_right'] = 'pan_right'

Effect type. Must be "pan_right".

PanLeftEffect

Bases: BasePanEffect

A right to left pan effect.

type class-attribute instance-attribute

type: Literal['pan_left'] = 'pan_left'

Effect type. Must be "pan_left".

PanDownEffect

Bases: BasePanEffect

A top to bottom pan effect.

type class-attribute instance-attribute

type: Literal['pan_down'] = 'pan_down'

Effect type. Must be "pan_down".

PanUpEffect

Bases: BasePanEffect

A bottom to top pan effect.

type class-attribute instance-attribute

type: Literal['pan_up'] = 'pan_up'

Effect type. Must be "pan_up".