Apply entrance, exit, and loop animations to design blocks using the available animation types in CE.SDK.
CE.SDK organizes animations into three categories: entrance (In), exit (Out), and loop. Each category determines when the animation plays during the block’s lifecycle. This guide demonstrates different animation types and their configurable properties.
The snippets use existing graphic blocks in a video scene and focus on the animation APIs. Use the Base Animations guide when you need the lower-level flow for creating, attaching, replacing, and reading animations.
Entrance Animations#
Entrance animations define how a block appears. Use createAnimation() with an AnimationType and attach it with setInAnimation().
Slide Animation#
The slide animation moves a block in from a specified direction. The animation/slide/direction property uses radians where 0 is right, PI / 2 is bottom, PI is left, and 3 * PI / 2 is top. Use animation/slide/fade when the slide should also fade opacity during the movement.
val slideAnimation = engine.block.createAnimation(AnimationType.Slide)engine.block.setInAnimation(block = slideBlock, animation = slideAnimation)engine.block.setDuration(block = slideAnimation, duration = 1.0)// Animation-specific fields are exposed through the generic property API.engine.block.setFloat( block = slideAnimation, property = "animation/slide/direction", value = PI.toFloat(),)engine.block.setEnum(block = slideAnimation, property = "animationEasing", value = "EaseOut")Fade Animation#
The fade animation transitions opacity from invisible to fully visible. Easing controls the animation curve.
val fadeAnimation = engine.block.createAnimation(AnimationType.Fade)engine.block.setInAnimation(block = fadeBlock, animation = fadeAnimation)engine.block.setDuration(block = fadeAnimation, duration = 1.0)engine.block.setEnum(block = fadeAnimation, property = "animationEasing", value = "EaseInOut")Zoom Animation#
The zoom animation scales the block from a smaller size to its final dimensions. The animation/zoom/fade property adds an opacity transition during scaling.
val zoomAnimation = engine.block.createAnimation(AnimationType.Zoom)engine.block.setInAnimation(block = zoomBlock, animation = zoomAnimation)engine.block.setDuration(block = zoomAnimation, duration = 1.0)engine.block.setBoolean(block = zoomAnimation, property = "animation/zoom/fade", value = true)Additional entrance animation types include:
AnimationType.Pan- Moves content across the blockAnimationType.Blur- Transitions from blurred to clearAnimationType.Wipe- Reveals with a directional wipeAnimationType.Baseline- Slides text in along its baselineAnimationType.Pop- Uses a bouncy scale effectAnimationType.Spin- Rotates the block into viewAnimationType.Grow- Scales up from a pointAnimationType.CropZoom- Zooms content inside the block frameAnimationType.KenBurns- Pans and zooms image or video content
Text-only entrance animation types include:
AnimationType.TypewriterText- Text-only character revealAnimationType.BlockSwipeText- Text-only block sweep revealAnimationType.SpreadText- Text-only letter spacing effectAnimationType.MergeText- Text-only line merge effect
Exit Animations#
Exit animations define how a block leaves the screen. Use setOutAnimation() to attach them. CE.SDK prevents overlap between entrance and exit durations automatically.
val wipeIn = engine.block.createAnimation(AnimationType.Wipe)engine.block.setInAnimation(block = exitBlock, animation = wipeIn)engine.block.setDuration(block = wipeIn, duration = 1.0)engine.block.setEnum(block = wipeIn, property = "animation/wipe/direction", value = "Right")
val fadeOut = engine.block.createAnimation(AnimationType.Fade)engine.block.setOutAnimation(block = exitBlock, animation = fadeOut)engine.block.setDuration(block = fadeOut, duration = 1.0)engine.block.setEnum(block = fadeOut, property = "animationEasing", value = "EaseIn")In this example, a wipe entrance transitions to a fade exit. Mirror entrance effects for visual consistency, or use contrasting effects for emphasis.
Loop Animations#
Loop animations run continuously while the block is visible. They can combine with entrance and exit animations. Use setLoopAnimation() to attach them.
val breathingLoop = engine.block.createAnimation(AnimationType.BreathingLoop)engine.block.setLoopAnimation(block = loopBlock, animation = breathingLoop)engine.block.setDuration(block = breathingLoop, duration = 2.0)// Intensity 0 scales to 1.25, while intensity 1 scales to 2.5.engine.block.setFloat( block = breathingLoop, property = "animation/breathing_loop/intensity", value = 0.3F,)The duration controls each cycle length. Loop animation types include:
AnimationType.BreathingLoop- Slow scale pulseAnimationType.PulsatingLoop- Rhythmic scaleAnimationType.SpinLoop- Continuous rotationAnimationType.FadeLoop- Opacity cyclingAnimationType.SwayLoop- Rotational oscillationAnimationType.JumpLoop- Jumping motionAnimationType.BlurLoop- Blur cyclingAnimationType.SqueezeLoop- Squeezing effectAnimationType.ScaleLoop- Continuous scale animation
Combined Animations#
A single block can have entrance, exit, and loop animations running together. The loop animation runs throughout the block’s visibility while entrance and exit animations play at the appropriate times. For spin animations, animation/spin/fade controls whether the rotation also fades opacity.
val spinIn = engine.block.createAnimation(AnimationType.Spin)engine.block.setInAnimation(block = combinedBlock, animation = spinIn)engine.block.setDuration(block = spinIn, duration = 1.0)engine.block.setEnum(block = spinIn, property = "animation/spin/direction", value = "Clockwise")engine.block.setFloat(block = spinIn, property = "animation/spin/intensity", value = 0.5F)
val blurOut = engine.block.createAnimation(AnimationType.Blur)engine.block.setOutAnimation(block = combinedBlock, animation = blurOut)engine.block.setDuration(block = blurOut, duration = 1.0)
val swayLoop = engine.block.createAnimation(AnimationType.SwayLoop)engine.block.setLoopAnimation(block = combinedBlock, animation = swayLoop)engine.block.setDuration(block = swayLoop, duration = 1.5)Configuring Animation Properties#
Each animation type has specific configurable properties. Use findAllProperties() to discover available properties and getEnumValues() to query options for enum properties.
val slideProperties = engine.block.findAllProperties(slideAnimation)val easingOptions = engine.block.getEnumValues("animationEasing")Common configurable properties include:
- Direction: Controls entry or exit direction in radians or enum values
- Easing: Sets the animation curve, such as
Linear,EaseIn,EaseOut, orEaseInOut - Intensity: Controls the strength of the effect, with exact behavior depending on the animation type
- Fade: Adds or removes an opacity transition
API Reference#
| Method | Description |
|---|---|
engine.block.supportsAnimation(block=_) | Returns whether the block can have animations. |
engine.block.createAnimation(type=_) | Creates an animation of the given AnimationType. |
engine.block.setInAnimation(block=_, animation=_) | Attaches an entrance animation to a block. |
engine.block.setOutAnimation(block=_, animation=_) | Attaches an exit animation to a block. |
engine.block.setLoopAnimation(block=_, animation=_) | Attaches a loop animation to a block. |
engine.block.setDuration(block=_, duration=_) | Sets the animation duration in seconds. |
engine.block.setFloat(block=_, property="animation/slide/direction", value=_) | Sets the slide direction in radians. |
engine.block.setBoolean(block=_, property="animation/slide/fade", value=_) | Enables or disables opacity fading during a slide animation. |
engine.block.setFloat(block=_, property="animation/breathing_loop/intensity", value=_) | Sets the breathing-loop scale intensity. |
engine.block.setFloat(block=_, property="animation/spin/intensity", value=_) | Sets how far the spin animation rotates. |
engine.block.setEnum(block=_, property="animationEasing", value=_) | Sets the animation easing curve: Linear, EaseIn, EaseOut, EaseInOut, EaseInQuart, EaseOutQuart, EaseInOutQuart, EaseInQuint, EaseOutQuint, EaseInOutQuint, EaseInBack, EaseOutBack, EaseInOutBack, EaseInSpring, EaseOutSpring, or EaseInOutSpring. |
engine.block.setEnum(block=_, property="animation/wipe/direction", value=_) | Sets the wipe direction: Up, Right, Down, or Left. |
engine.block.setEnum(block=_, property="animation/spin/direction", value=_) | Sets the spin direction: Clockwise or CounterClockwise. |
engine.block.setBoolean(block=_, property="animation/spin/fade", value=_) | Enables or disables opacity fading during a spin animation. |
engine.block.setBoolean(block=_, property="animation/zoom/fade", value=_) | Enables or disables the zoom fade. |
engine.block.findAllProperties(block=_) | Lists the properties available on an animation block. |
engine.block.getEnumValues(enumProperty=_) | Lists supported values for an enum property. |
Next Steps#
- Base Animations - Create and attach animations to blocks
- Text Animations - Animate text with writing styles
- Animation Overview - Review animation concepts and capabilities