Effects and Transitions

An effect is how one visual hands over to the next. When an image or clip ends and another begins, the two can cross-fade, slide, iris, or zoom into each other instead of cutting hard. Effects live on the visuals themselves: you place an image or a clip, then attach an effect to it.

Attaching an effect

add_image and add_video return a handle, and the handle has add_effect. Calls chain, so you can attach more than one:

from imaginaryarts import Effects

video.add_image(images[0], interval=[0, 4000]) \
     .add_effect(Effects.FadeIn(250)) \
     .add_effect(Effects.Slide(400, direction="left"))

video.add_image(images[1], interval=[4000, 8000]) \
     .add_effect(Effects.FadeOut(500))

Read that as: the first image fades in from the background at the start of the video, slides out to the left into the second image, and the second image fades out to the background at the end.

The effects

EffectWhat it does
Effects.FadeIn(ms=250)Fades the visual in. On the first visual of the video it fades up from the background color.
Effects.FadeOut(ms=250)Cross-fades into the next visual. On the last visual of the video it fades down to the background color.
Effects.CircleOpen(ms=250)The next visual opens from a circle in the middle of the frame. Hard-edged, no blending.
Effects.CircleClose(ms=250)The current visual closes into a circle, revealing the next one. Hard-edged.
Effects.Slide(ms=250, direction="left")Pushes the next visual in from an edge. direction is "left", "right", "up" or "down".
Effects.ZoomIn(ms=250)Holds the outgoing frame for the first half, then zooms and cross-fades the next one in. Give it about twice a fade's duration.

Every effect takes its duration in milliseconds and defaults to 250, a quick, unobtrusive handover.

Which visual gets the effect

Every effect except FadeIn describes the end of a visual, so you attach it to the visual the cut is leaving. fleet.add_effect(Effects.ZoomIn(1200)) means "when the fleet shot ends, zoom into whatever comes next".

When both sides of a cut ask for a transition, the longer one wins and brings its kind with it. If they are equally long, the outgoing side wins.

The very start and very end of the video are not cuts. They are a fade from and to the background color, so the only effects allowed at the start of the first visual and the end of the last visual are FadeIn and FadeOut. Anything else there raises an error.

How transitions affect timing

A transition straddles its cut: half of it plays over the end of the outgoing visual and half over the start of the incoming one. The library renders both sides a little longer to cover that overlap, so the total length of the video is still exactly the sum of your intervals. Captions, voice and music never drift because of a transition.