npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cnippet-aos

v1.0.6

Published

A lightweight animation on scroll/load library built with Motion

Readme

Cnippet Animate On Scroll (AOS)

A lightweight animation on scroll/load library built with Motion (Framer Motion). It provides smooth, performant animations that trigger when elements enter the viewport with extensive customization options.

Installation

npm install cnippet-aos motion
# or
pnpm add cnippet-aos motion
# or
yarn add cnippet-aos motion

Features

  • ✨ Smooth Animations: Powered by Framer Motion for buttery-smooth transitions
  • ⚡ Scroll Triggered: Animations activate when elements enter viewport
  • 🪶 Responsive: Works seamlessly across all devices
  • 🗃️ Lightweight: Minimal bundle size impact
  • 🔥 Highly Customizable: Extensive animation options and parameters
  • 🌟 Accessible: Respects reduced motion preferences
  • 📝 30+ Animation Variants: Fade, slide, zoom, scale, rotate, and blur effects

Usage Methods

Method 1: Using Animation Functions (Recommended)

Import animation functions and spread them directly on motion components:

import { motion } from "motion/react";
import { fadeUp, fadeUpBlur, slideLeft, zoomIn } from "cnippet-aos";

function MyComponent() {
  return (
    <div>
      <motion.h2
        {...fadeUpBlur({
          delay: 0.1,
          duration: 0.8,
          scroll: true,
          once: true,
        })}
      >
        Animated Heading
      </motion.h2>
      
      <motion.p
        {...fadeUp({
          delay: 0.3,
          duration: 0.6,
          scroll: true,
          once: true,
        })}
      >
        This text fades up smoothly
      </motion.p>
    </div>
  );
}

Complete Animation Reference

Fade Animations

import { fadeIn, fadeUp, fadeDown, fadeLeft, fadeRight } from "cnippet-aos";

// Simple fade in
<motion.div {...fadeIn({ delay: 0.2 })}>

// Fade with movement
<motion.div {...fadeUp({ y: 50, duration: 0.8 })}>
<motion.div {...fadeDown({ y: -30 })}>
<motion.div {...fadeLeft({ x: 30 })}>
<motion.div {...fadeRight({ x: -30 })}>

Fade with Blur Animations

import { 
  fadeInBlur, 
  fadeUpBlur, 
  fadeDownBlur, 
  fadeLeftBlur, 
  fadeRightBlur 
} from "cnippet-aos";

// Fade with blur effects
<motion.div {...fadeUpBlur({ filter: 15 })}> // Custom blur amount
<motion.div {...fadeInBlur({ duration: 1 })}>

Slide Animations

import { slideUp, slideDown, slideLeft, slideRight } from "cnippet-aos";

<motion.div {...slideUp({ y: 100 })}>
<motion.div {...slideDown({ y: -100 })}>
<motion.div {...slideLeft({ x: 100 })}>
<motion.div {...slideRight({ x: -100 })}>

Zoom Animations

import { 
  zoomIn, zoomOut, zoomUp, zoomDown, zoomLeft, zoomRight 
} from "cnippet-aos";

<motion.div {...zoomIn({ scale: 0.5 })}>
<motion.div {...zoomOut({ scale: 1.5 })}>
<motion.div {...zoomUp({ scale: 0.3 })}>

Scale Animations

import { scaleIn, scaleOut, scaleBounce, scaleElastic } from "cnippet-aos";

// Spring-based scale animations
<motion.div {...scaleIn({ type: "spring", bounce: 0.4 })}>
<motion.div {...scaleBounce({ scale: 0.8 })}>

Rotate Animations

import { rotateIn, rotateOut, rotateSpin, rotateFlip } from "cnippet-aos";

<motion.div {...rotateIn({ rotate: -90 })}>
<motion.div {...rotateSpin({ rotate: 360, duration: 1 })}>
<motion.div {...rotateFlip({ rotate: 180 })}>

Animation Options Reference

| Parameter | Type | Default | Description | |---------------|---------|-------------|----------------------------------------------------| | delay | number | 0 | Delay before animation starts (seconds) | | duration | number | 0.6 | Animation duration in seconds | | ease | string | "easeOut" | CSS easing function | | once | boolean | true | Whether animation should happen only once | | amount | number | 0.25 | Viewport threshold (0-1) when animation triggers | | type | string | "tween" | Animation type: "spring", "tween", or "inertia" | | stiffness | number | 100 | Spring animation stiffness | | damping | number | 10 | Spring animation damping | | mass | number | 1 | Spring animation mass | | bounce | number | 0 | Spring animation bounce | | repeat | number | 0 | Number of times to repeat animation | | repeatType | string | "loop" | Repeat type: "loop", "reverse", "mirror" | | scroll | boolean | false | Whether to trigger on scroll (vs on load) | | y | number | 30 | Vertical starting position for animations | | x | number | 30 | Horizontal starting position for animations | | scale | number | 0.5 | Starting scale for scale/zoom animations | | rotate | number | -45 | Starting rotation for rotate animations | | filter | number | 10 | Starting blur amount for blur animations | | customInitial | object | {} | Custom initial animation state | | customAnimate | object | {} | Custom target animation state |

Advanced Usage Examples

Spring Physics Animations

<motion.div
  {...scaleIn({
    type: "spring",
    stiffness: 200,
    damping: 15,
    mass: 1,
    bounce: 0.5,
    duration: 1.2,
  })}
>
  Springy element
</motion.div>

Looping Animations

<motion.div
  {...rotateSpin({
    repeat: Infinity,
    repeatType: "loop",
    duration: 2,
    scroll: false, // Start immediately, not on scroll
  })}
>
  Continuously spinning
</motion.div>

Custom Animation States

<motion.div
  {...fadeUp({
    customInitial: { 
      opacity: 0, 
      y: 100,
      backgroundColor: "#ff0000" 
    },
    customAnimate: { 
      opacity: 1, 
      y: 0,
      backgroundColor: "#00ff00" 
    },
    duration: 1.5,
  })}
>
  Custom color transition
</motion.div>

Complex Staggered Layout

import { motion } from "motion/react";
import { fadeUpBlur, zoomIn } from "cnippet-aos";

function FeaturesGrid() {
  const features = [
    { title: "Feature 1", icon: "🚀" },
    { title: "Feature 2", icon: "🎨" },
    { title: "Feature 3", icon: "⚡" },
  ];

  return (
    <div className="grid grid-cols-1 md:grid-cols-3 gap-8">
      {features.map((feature, index) => (
        <motion.div
          key={index}
          className="p-6 bg-white rounded-lg shadow-lg"
          {...fadeUpBlur({
            delay: 0.2 + index * 0.1,
            y: 50,
            duration: 0.8,
            scroll: true,
            once: true,
            filter: 8, // Custom blur amount
          })}
          whileHover={{
            scale: 1.05,
            transition: { type: "spring", stiffness: 400 }
          }}
        >
          <motion.div
            className="text-3xl mb-4"
            {...zoomIn({
              delay: 0.4 + index * 0.1,
              scale: 0.5,
              duration: 0.6,
            })}
          >
            {feature.icon}
          </motion.div>
          <h3 className="text-xl font-semibold">{feature.title}</h3>
        </motion.div>
      ))}
    </div>
  );
}

Sequential Animation Chain

function HeroSection() {
  return (
    <section className="relative h-full">
      <motion.h1
        {...fadeUpBlur({
          delay: 0.1,
          duration: 1,
          scroll: true,
          y: 80,
          filter: 12,
        })}
      >
        Welcome Here
      </motion.h1>
      
      <motion.p
        {...fadeUp({
          delay: 0.3,
          duration: 0.8,
          scroll: true,
          y: 40,
        })}
      >
        Discover amazing features
      </motion.p>
      
      <motion.div
        {...zoomIn({
          delay: 0.6,
          duration: 0.7,
          scroll: true,
          scale: 0.8,
        })}
      >
        <button>Get Started</button>
      </motion.div>
    </section>
  );
}

Performance Tips

  • Use once={true} for static content that doesn't need re-animation
  • Chain delays for sequential animations rather than using heavy staggers
  • Use type: "tween" for simple animations and type: "spring" for physics-based
  • Set scroll={false} for animations that should trigger on load only
  • Use blur effects sparingly on low-performance devices
  • Prefer repeat: 0 (default) in most cases to avoid unnecessary loops

Browser Support

Works in all modern browsers that support:

  • Intersection Observer API
  • CSS transforms, filters, and 3D transforms
  • ES6+ features

For older browsers, consider adding polyfills for Intersection Observer.

License

MIT © Cnippet

Enjoy building beautiful, performant animations! 🚀