Skip to Content
vitus·labs
Kinetic Presets

Kinetic Presets

122 ready-to-use animation presets, 5 customizable factories, and 5 composition utilities for @vitus-labs/kinetic.

@vitus-labs/kinetic-presets provides a library of 122 animation presets organized into 25 categories, plus 5 factory functions for creating custom presets and 5 composition utilities. The whole package is ~4 KB min+gzipped, and every preset is individually tree-shakeable.

What's new in 2.9 — clipDiamond's end state now fully uncovers the corners; withEasing rewrites every segment of a multi-property transition (not just the last one); and scaleOut, zoomOut* and puffOut are documented as the entrances they are (names unchanged). Since 2.8, reverse() keeps the visible end state and withDuration() / withDelay() handle comma-separated transitions, cubic-bezier(...) and decimal times.

Installation

npm install @vitus-labs/kinetic-presets

Peer dependencies: react >= 19. Presets are plain objects, structurally compatible with @vitus-labs/kinetic's Preset type — install @vitus-labs/kinetic to render them.

Try It Live

Pick a preset and toggle visibility. Each option is a real preset from @vitus-labs/kinetic-presets passed to kinetic('div').preset(); custom is built with createSlide, compose and withDuration:

Quick Start

import { kinetic } from '@vitus-labs/kinetic'
import { fadeUp, scaleIn, compose, withDuration } from '@vitus-labs/kinetic-presets'

// Use a preset directly
const FadeCard = kinetic('div').preset(fadeUp)

// Customize duration
const SlowFade = kinetic('div').preset(withDuration(fadeUp, 500))

// Compose multiple effects
const FadeScale = kinetic('div').preset(compose(fadeUp, scaleIn))

Preset Categories

All 122 presets are organized into 25 categories:

CategoryCountExamples
Fades14fade, fadeUp, fadeDownBig, fadeUpLeft
Slides8slideUp, slideDown, slideLeftBig
Scales9scaleIn, scaleUp, scaleDown, scaleRotateIn
Blurs6blurIn, blurInDown, blurScale
Bounces5bounceIn, bounceInDown, bounceInLeft
Rotations4rotateIn, rotateInReverse, rotateInDown
Flips6flipX, flipY, flipDiagonal
Zooms10zoomIn, zoomOut, zoomInDown, zoomOutLeft
Clip Path8clipCircle, clipDiamond, clipCenter
Perspective4perspectiveUp, perspectiveDown
Swings4swingInTop, swingInBottom, swingInLeft
Tilts4tiltInUp, tiltInDown, tiltInLeft
Floats4floatUp, floatDown, floatLeft
Flies4flyInUp, flyInDown, flyInLeft
Light Speed2lightSpeedInLeft, lightSpeedInRight
Back4backInUp, backInDown, backInLeft
Pushes2pushInLeft, pushInRight
Rolls2rollInLeft, rollInRight
Swirls2swirlIn, swirlInReverse
Slits2slitHorizontal, slitVertical
Expand2expandX, expandY
Squish2squishX, squishY
Skews4skewIn, skewInReverse, skewInY
Special8popIn, puffIn, rubberIn, newspaperIn, springIn, spinIn
Drop/Rise2drop, rise

Factories

5 factory functions create custom presets with full control over timing, easing, and parameters:

FactoryCreatesKey Options
createFadeFade with optional directiondirection, distance, duration
createSlideDirectional slidedirection, distance, duration
createScaleScale transformfrom, duration, easing
createRotateRotationdegrees, duration, easing
createBlurBlur + optional scaleamount, scale, duration

Composition Utilities

5 utility functions modify and combine presets:

UtilityDescriptionExample
composeMerge multiple presets into onecompose(fade, slideUp)
withDurationOverride enter/leave durationwithDuration(fade, 500, 200)
withEasingOverride enter/leave easingwithEasing(fade, 'ease-in-out')
withDelaySet a delay on the transitionswithDelay(fade, 100)
reverseSwap the motion direction, keep the visible statereverse(slideUp)

Common Patterns

Page Section Reveal

Animate sections as users scroll into view:

import { kinetic } from '@vitus-labs/kinetic'
import { fadeUp, withDuration, withEasing } from '@vitus-labs/kinetic-presets'
import { useIntersection } from '@vitus-labs/hooks'

const RevealSection = kinetic('section')
  .preset(withEasing(withDuration(fadeUp, 600), 'cubic-bezier(0.16, 1, 0.3, 1)'))

function HeroSection({ children }) {
  const [ref, entry] = useIntersection({ threshold: 0.2 })
  const visible = entry?.isIntersecting ?? false

  return (
    <div ref={ref}>
      <RevealSection show={visible} appear>
        {children}
      </RevealSection>
    </div>
  )
}

Tooltip with Directional Presets

Choose the animation based on placement:

import { kinetic } from '@vitus-labs/kinetic'
import { fadeUp, fadeDown, fadeLeft, fadeRight } from '@vitus-labs/kinetic-presets'

// Create components once at module level — creating them during render
// would remount the element on every render.
const tooltips = {
  top: kinetic('div').preset(fadeDown),    // tooltip above: slides down into view
  bottom: kinetic('div').preset(fadeUp),   // tooltip below: slides up into view
  left: kinetic('div').preset(fadeRight),  // tooltip left: slides right into view
  right: kinetic('div').preset(fadeLeft),  // tooltip right: slides left into view
}

function Tooltip({ show, placement = 'top', children }) {
  const Component = tooltips[placement]

  return (
    <Component show={show} role="tooltip">
      {children}
    </Component>
  )
}

Sequential Feature Cards

import { kinetic } from '@vitus-labs/kinetic'
import { bounceIn } from '@vitus-labs/kinetic-presets'

const StaggerCards = kinetic('div')
  .preset(bounceIn)
  .stagger({ interval: 80, reverseLeave: true })

function Features({ features, visible }) {
  return (
    <StaggerCards show={visible} appear>
      {features.map((f) => (
        <div key={f.id} className="feature-card">
          <h3>{f.title}</h3>
          <p>{f.description}</p>
        </div>
      ))}
    </StaggerCards>
  )
}

Animated Route Transitions

import { kinetic } from '@vitus-labs/kinetic'
import { fade, slideLeft, compose, withDuration } from '@vitus-labs/kinetic-presets'

const PageTransition = kinetic('div').preset(
  withDuration(compose(fade, slideLeft), 200, 150)
)

// In your layout
function Layout({ children, routeKey }) {
  return (
    <PageTransition show={true} appear key={routeKey}>
      <main>{children}</main>
    </PageTransition>
  )
}

How Presets Work

A preset is a plain object with enter/leave style and class definitions:

// This is what fadeUp looks like internally:
const fadeUp = {
  enterStyle: { opacity: 0, transform: 'translateY(16px)' },
  enterToStyle: { opacity: 1, transform: 'translateY(0)' },
  enterTransition: 'all 300ms ease-out',
  leaveStyle: { opacity: 1, transform: 'translateY(0)' },
  leaveToStyle: { opacity: 0, transform: 'translateY(16px)' },
  leaveTransition: 'all 200ms ease-in',
}

All 122 presets follow this symmetric pattern (leave reverses enter). The library uses a compact internal helper that generates both directions from a single pair of states, keeping the bundle small despite the large number of presets.

Tree-Shaking

All 122 presets are individually exported for tree-shaking. Import only what you use:

// Only bundles fadeUp and scaleIn — everything else is eliminated
import { fadeUp, scaleIn } from '@vitus-labs/kinetic-presets'

The presets object re-exports everything as a single object (useful for exploration/debugging), but prefer named imports for production builds.

Exports

import {
  // Factories
  createFade,
  createSlide,
  createScale,
  createRotate,
  createBlur,

  // Utilities
  compose,
  withDuration,
  withEasing,
  withDelay,
  reverse,

  // All 122 presets (named exports)
  fade,
  fadeUp,
  fadeDown,
  // ... see full list in Presets Reference

  // All presets as object
  presets,
} from '@vitus-labs/kinetic-presets'

import type {
  Preset,
  Direction,
  FadeOptions,
  SlideOptions,
  ScaleOptions,
  RotateOptions,
  BlurOptions,
} from '@vitus-labs/kinetic-presets'
Edit on GitHub

Last updated on

On this page