spring-in
remotionui/spring-inFreeComponent
Spring-driven scale and rise, with snappy, smooth and bouncy presets
Live preview
live · rendered by the registry
Rendered by remotionui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://remotionui.com/r/spring-in.jsonSource
1import { interpolate, useVideoConfig } from "remotion";2import { scaleFont } from "@/remotion/lib/layout";3import {4 resolveOrigin,5 useEnterExit,6 type MotionPrimitiveProps,7 type MotionSpring,8 type TransformOrigin,9} from "@/remotion/lib/motion-primitive";10import { MotionWrapper } from "@/remotion/lib/motion-wrapper";1112export type SpringInProps = Omit<MotionPrimitiveProps, "spring"> & {13 /** Spring preset name, or an override on the snappy config. */14 config?: MotionSpring;15 /** Scale at the start of the entrance. */16 from?: number;17 /** How far it rises as it springs. Scales with the frame by default. */18 travel?: number;19 origin?: TransformOrigin;20};2122/**23 * The physical entrance: scale and a short rise driven by a spring, so the24 * element carries weight into its stop instead of easing to a halt.25 *26 * `config="bouncy"` overshoots — both the scale and the rise pass their27 * resting value and settle back, which is the point of using a spring at all.28 */29export const SpringIn: React.FC<SpringInProps> = ({30 children,31 config = "snappy",32 from = 0.88,33 travel: travelProp,34 origin = "center",35 block,36 style,37 className,38 ...motionProps39}) => {40 const { width } = useVideoConfig();41 const travel = travelProp ?? scaleFont(14, width);42 const { motion, displace, opacity, sign } = useEnterExit({43 ...motionProps,44 spring: config,45 });4647 const scale = interpolate(motion, [0, 1], [from, 1]);4849 return (50 <MotionWrapper51 block={block}52 className={className}53 style={{54 ...style,55 opacity,56 scale,57 translate: `0px ${displace * travel * sign}px`,58 transformOrigin: resolveOrigin(origin),59 }}60 >61 {children}62 </MotionWrapper>63 );64};
More from remotionui
All 127 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| audio-pulseaudio-pulse | remotionui | Components | Free | no deps | |
| audiogram-barsaudiogram-bars | remotionui | Components | Free | no deps | |
| blur-focus-inblur-focus-in | remotionui | Components | Free | no deps | |
| blur-inblur-in | remotionui | Components | Free | no deps | |
| blur-revealblur-reveal | remotionui | Components | Free | no deps | |
| caption-highlightcaption-highlight | remotionui | Components | Free | no deps | |
| chromatic-aberration-wipechromatic-aberration-wipe | remotionui | Components | Free | no deps | |
| confetti-burstconfetti-burst | remotionui | Components | Free | no deps |
