Sliding Text
A Remotion video component that animates sliding text into the scene.
Installation
CLI
Manual
Create a new file, for example, at src/components/clippkit/sliding-text.tsx
(or your preferred location) and paste the following code into it.
Usage
Once the SlidingText
component is added to your project (either via CLI or Manually), you can integrate it into your Remotion project by importing it and defining a Composition
.
Prerequisite
Ensure you have a Remotion project set up. If not, please refer to the Remotion documentation to get started.
Project Structure Example
Here’s an example folder layout showing where to place the component and how it fits into a typical Remotion project
Define a Composition
In your Remotion project's entry file (commonly src/Root.tsx
, src/index.tsx
, app/main.tsx
), import SlidingText
and define a Composition
.
API Reference
The component exported as SlidingText
(e.g., from apps/docs/registry/default/ui/sliding-text.tsx
or your project's component path) accepts the following props to customize its animation and appearance:
Prop | Type | Default Value | Description |
---|---|---|---|
text | string | "Sliding Text!" | The text content to display. |
textColor | string | "var(--foreground)" | The color of the text. Accepts any valid CSS color value. |
fontSize | string | "4rem" | The font size of the text. Accepts any valid CSS font-size value. |
slideDirection | "left" | "right" | "top" | "bottom" | "left" | The direction from which the text slides in. |
durationInFrames | number | 30 | The duration of the slide and fade-in animation in frames. |
initialOffset | number | 200 | The initial offset (in pixels) from which the text slides. |
damping | number | 12 | The damping anount for the spring animation. Controls how quickly oscillations die down. |
mass | number | 0.5 | The mass for the spring animation. |
stiffness | number | 100 | The stiffness for the spring animation. |