Introducing Nuvyx UI v1.0.0

Docs
Scroll Animation Trigger

Scroll Animation Trigger

UI elements that change color, size, or shape based on scroll progress. Text that reveals dynamically when entering the viewport.

Scroll Down Here

Scroll down to see the ScrollAnimationTrigger in action

Fade In Effect

This content gently fades into view as you scroll down the page, creating a subtle and elegant appearance that draws attention without being distracting.

Scale Effect

Watch as this content smoothly scales from small to full size as you scroll, creating a dynamic entrance that captures attention and adds visual depth.

Scale StartScale Complete

Custom Animation

This demonstrates a custom animation path combining multiple movements and rotations. Create your own unique entrance effects with complete creative freedom.

Movement
Diagonal Slide
Rotation
-10° to 0°

Slide Up Effect

This content slides gracefully into view from below, creating a smooth transition that guides the eye naturally as you explore the page content.

SmoothElegantNatural

Installation

Examples

Color change

Color Change

Watch the text transform through vibrant colors as you scroll through this section, creating a playful and engaging visual experience tied to your scroll position.

rotation

Rotation Effect

This content spins into place as you scroll, adding a dynamic and playful element to the page that catches the eye.

Usage

import { ScrollAnimationTrigger } from "@/components/ui/scroll-animation-trigger";
// Basic fade-in effect
export function FadeInExample() {
  return (
    <div className="w-full max-w-md mx-auto">
      <ScrollAnimationTrigger effect="fade" threshold={0.1} once={true}>
        <div className="p-6 bg-white dark:bg-zinc-800 rounded-lg shadow-md">
          <h3 className="text-xl font-bold">Fade In Animation</h3>
          <p className="mt-2">This content fades in when scrolled into view.</p>
        </div>
      </ScrollAnimationTrigger>
    </div>
  );
}
 
// Slide animation with direction
export function SlideInExample() {
  return (
    <div className="w-full max-w-md mx-auto">
      <ScrollAnimationTrigger
        effect="slide"
        direction="up"
        delay={0.2}
        duration={0.6}
      >
        <div className="p-6 bg-white dark:bg-zinc-800 rounded-lg shadow-md">
          <h3 className="text-xl font-bold">Slide Up Animation</h3>
          <p className="mt-2">
            This content slides up when scrolled into view.
          </p>
        </div>
      </ScrollAnimationTrigger>
    </div>
  );
}
 
// Color transition effect
export function ColorChangeExample() {
  return (
    <div className="w-full max-w-md mx-auto">
      <ScrollAnimationTrigger
        effect="color"
        fromColor="#2b13c2"
        toColor="#f002cc"
        threshold={0.2}
      >
        <div className="p-6 bg-white dark:bg-zinc-800 rounded-lg shadow-md">
          <h3 className="text-xl font-bold">Color Transition</h3>
          <p className="mt-2">This text changes color as you scroll.</p>
        </div>
      </ScrollAnimationTrigger>
    </div>
  );
}

Props

ScrollAnimationTrigger

PropTypeDefaultDescription
childrenReactNodeundefinedThe content to be animated
effectstring"fade"The animation effect - (fade, scale, slide, color, rotate, custom)
thresholdnumber0.1The threshold for triggering the animation (0-1)
delaynumber0Delay before the animation starts (in seconds)
durationnumber0.5Duration of the animation (in seconds)
directionstring"up"Direction for slide animation - (up, down, left, right)
oncebooleanfalseWhether to trigger the animation only once
customPropsobject{}Custom animation properties for the 'custom' effect
asReact.ElementType"div"The element type to render - (div, span, etc)
classNamestring""Additional CSS classes to apply
fromColorstring"var(--color-muted)"Starting color for color transition
toColorstring"var(--color-primary)"Ending color for color transition
fromRotationnumber-10Initial rotation angle for rotate effect
toRotationnumber0Final rotation angle for rotate effect
fromScalenumber0.8Initial scale value for scale effect
toScalenumber1Final scale value for scale effect