Source code for moviepy.video.fx.MirrorX
from dataclasses import dataclass
from typing import List, Union
from moviepy.Clip import Clip
from moviepy.Effect import Effect
[docs]
@dataclass
class MirrorX(Effect):
"""Flips the clip horizontally (and its mask too, by default)."""
apply_to: Union[List, str] = "mask"
[docs]
def apply(self, clip: Clip) -> Clip:
"""Apply the effect to the clip."""
return clip.image_transform(lambda img: img[:, ::-1], apply_to=self.apply_to)