Skip to main content
Fade effects create smooth transitions by animating the opacity of a clip over time. MovieLite provides two fade effects: FadeIn and FadeOut.

FadeIn

Gradually increases opacity from 0 to the clip’s original opacity over the specified duration.

Constructor

FadeIn(duration: float)
duration
float
required
Duration of the fade in seconds, measured from the start of the clip.

Example

from movielite import VideoClip, VideoWriter, vfx

clip = VideoClip("input.mp4")
clip.add_effect(vfx.FadeIn(duration=2.0))

writer = VideoWriter("output.mp4", fps=clip.fps, size=clip.size)
writer.add_clip(clip)
writer.write()
clip.close()

How It Works

The FadeIn effect modifies the clip’s opacity function to create a gradual transition:
  • t < duration: Opacity = original_opacity × (t / duration)
  • t ≥ duration: Opacity = original_opacity (no change)
Source: src/movielite/vfx/fade.py:4-30

FadeOut

Gradually decreases opacity from the clip’s original opacity to 0 over the specified duration.

Constructor

FadeOut(duration: float)
duration
float
required
Duration of the fade in seconds, measured from the end of the clip.

Example

from movielite import VideoClip, VideoWriter, vfx

clip = VideoClip("input.mp4")
clip.add_effect(vfx.FadeOut(duration=1.5))

writer = VideoWriter("output.mp4", fps=clip.fps, size=clip.size)
writer.add_clip(clip)
writer.write()
clip.close()

How It Works

The FadeOut effect modifies the clip’s opacity function:
  • t ≤ (clip_duration - duration): Opacity = original_opacity (no change)
  • t > (clip_duration - duration): Opacity = original_opacity × (1 - fade_progress)
Where fade_progress = (t - (clip_duration - duration)) / duration Source: src/movielite/vfx/fade.py:32-59

Combining Fade Effects

You can apply both fade-in and fade-out to the same clip:
clip = VideoClip("input.mp4")
clip.add_effect(vfx.FadeIn(duration=2.0))
clip.add_effect(vfx.FadeOut(duration=1.5))
Make sure the combined duration of fade-in and fade-out doesn’t exceed the clip duration, or they will overlap.

With Other Effects

Fade effects work well with other visual effects:
clip = VideoClip("input.mp4")

# Fade in with blur
clip.add_effect(vfx.FadeIn(1.0))
clip.add_effect(vfx.BlurIn(duration=1.0, max_intensity=15.0))

# Color adjustments
clip.add_effect(vfx.Saturation(1.3))
clip.add_effect(vfx.Vignette(intensity=0.5))

# Fade out
clip.add_effect(vfx.FadeOut(1.5))

Technical Details

Fade effects modify the clip’s opacity function rather than manipulating pixel values directly. This makes them very efficient and allows them to work seamlessly with other effects.

Implementation Notes

  • Fade effects wrap the existing opacity function with a time-based multiplier
  • The original opacity is preserved and multiplied by the fade factor
  • Linear interpolation is used for smooth transitions
  • No pixel-level operations are performed, making fades very fast

See Also

Build docs developers (and LLMs) love