RemotionUI

Motion Trail

Echo trails behind a moving element, rendered from earlier frames. Install with npx remotion-ui@latest add motion-trail.

PrimitivePrimitivesAdvanced

motion-trail30fps · 960×540
Install
$ npx remotion-ui@latest add motion-trail

Where the thing just was.

import { MotionTrail } from "@/remotion/primitives/motion-trail";

<MotionTrail count={6} gapInFrames={3}>
  <TheMovingThing />
</MotionTrail>

The trick

An echo is not a copy of the element's position — it is the element itself, rendered at an earlier frame. <Sequence from={n}> shifts the frame its children see by -n, so an echo at from={gap * i} renders exactly what the subject looked like gap * i frames ago.

That means the trail is correct for any motion at all: rotation, colour changes, shape changes, a chart redrawing itself. There is no path to describe, no previous position to store, and nothing to keep in sync when the subject's animation changes.

The requirement

The child must animate from useCurrentFrame(). A subject positioned by a prop, or by a parent's transform, looks identical on every past frame and every echo stacks in one place. This is the one way to hold it wrong.

Cost

count echoes render the subtree count + 1 times per frame. Keep the subject small, and prefer a wider gapInFrames over a higher count when the trail needs length — a longer gap stretches the trail for free, where a higher count buys smoothness at full price.

Behaviour at the start

Echoes before frame gap * i do not exist yet, so a trail grows in naturally over its own length at the start of a composition rather than appearing fully formed on frame 0.

An echo is not a copy of a position — it is the subject re-rendered at an earlier frame, via `<Sequence from={gap * i}>`. That makes the trail correct for any motion, including rotation and colour change, with no path to describe. It also costs `count + 1` renders of the subtree per frame, so prefer a wider gap over a higher count.

Agent notes

Install first, then import the copied source component locally. AI guide →

Import
@/remotion/primitives/motion-trail
  • Use when: frame-level motion primitives and reusable animation wrappers.
  • Customize: count, gapInFrames, opacity, falloff, plus copied source for timing, layout, colors, and typography.
  • Rule: do not import this component from the remotion-ui npm package; it is copied into your project.

Usage

Example
import { MotionTrail } from "@/remotion/primitives/motion-trail"; <MotionTrail count={6} gapInFrames={3}> <TheMovingThing /> </MotionTrail>

API Reference

PropTypeDescription
childrenReactNodeThe moving element. It must animate from `useCurrentFrame()`.
countnumberHow many echoes trail behind.
gapInFramesnumberFrames between echoes. Wider gaps stretch the trail for free.
opacitynumberOpacity of the freshest echo.
falloffnumberHow fast echoes fade. 1 is linear, 2 keeps the tail short.
scalenumberScale of the oldest echo. 1 keeps them all the same size.
blurnumberBlur on the oldest echo, in px.
colorstringTint the echoes. Omit to echo the element's own colours.
blendModeCSS mix-blend-modeHow echoes composite. `screen` is right on a dark stage.
blockbooleanFill the parent instead of shrink-wrapping the subject.

Related

On this page