100+ Lightweight & Performant Web Animations – Ani-JS

Category: Animation , Javascript | August 24, 2025
AuthorSrinanth
Last UpdateAugust 24, 2025
LicenseMIT
Tags
Views146 views
100+ Lightweight & Performant Web Animations – Ani-JS

Ani-JS is a lightweight animation library that enhances your HTML elements and UI components with 100+ pre-built animations.

The library is built for developers who need quick, performant animations like fades, slides, and bounces without pulling in a heavy dependency like GSAP or Anime.js.

Features:

  • Zero Dependencies: No external libraries required, keeping bundle sizes minimal
  • Dual API Support: Use CSS classes or JavaScript functions for maximum flexibility
  • Framework Agnostic: Works with vanilla JavaScript, React, Vue, and other frameworks
  • Extensive Animation Library: 100+ animations including entrance, exit, hover, and color effects
  • Ultra-Lightweight: Only 3.6KB gzipped, significantly smaller than alternatives
  • Tailwind-Style Classes: Familiar utility-class naming convention for easy adoption
  • Performance Optimized: CSS-based animations with hardware acceleration support

How to use it:

1. Install the package via npm/yarn or link to the CDN:

# Yarn
$ yarn add ani-js
# NPM
$ npm install ani-js
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ani-js@latest/ani-js.css" />
<script type="module" src="https://cdn.jsdelivr.net/npm/ani-js@latest/index.js"></script>

2. The fastest way to use Ani-Js is by adding its utility classes to your HTML elements. The library mimics Tailwind’s class naming convention.

<!-- This element will fade in on load -->
<div class="tw-fade-in">Hello World</div>
<!-- This element will bounce when you hover over it -->
<button class="tw-hover-bounce">Click Me</button>

3. You can also import and call animation functions directly in your JavaScript. This is useful for animations triggered by events.

<div id="box">Animate Me</div>
<button id="action-btn">Trigger Animation</button>
<script type="module">
  import { fadeIn } from 'ani-js';
  document.getElementById('action-btn').addEventListener('click', () => {
    const el = document.getElementById('box');
    // The second argument is the duration in milliseconds
    fadeIn(el, 700);
  });
</script>

4. In a React component, you can use the class-based approach directly in your JSX or trigger animations inside a useEffect hook. I prefer the useEffect approach for animations that need to run after a component mounts or a state changes.

import '../node_modules/ani-js/ani-js.css';
import { useEffect, useRef } from 'react';
import { bounceIn } from 'ani-js';
function MyComponent() {
  const animatedEl = useRef(null);
  useEffect(() => {
    if (animatedEl.current) {
      // Animate the element after the component mounts
      bounceIn(animatedEl.current, 1000);
    }
  }, []); // Empty dependency array ensures it runs once on mount
  return <div ref={animatedEl}>I will bounce in!</div>;
}

Animation and Class Reference

Here is a full list of the animations available in Ani-Js. You can trigger them using the JavaScript function or by applying the corresponding utility class directly in your HTML.

Entrance Animations

Function NameCSS Class
fadeIntw-fade-in
slideUptw-slide-up
hingetw-hinge
stretchIntw-stretch-in
fadeInUptw-fade-in-up
slideDowntw-slide-down
slideLefttw-slide-left
slideRighttw-slide-right
zoomIntw-zoom-in
bounceIntw-bounce-in
flipInXtw-flip-in-x
flipInYtw-flip-in-y
rotateIntw-rotate-in
rollIntw-roll-in
lightSpeedIntw-light-speed-in
jackInTheBoxtw-jack-in-the-box
revealUptw-reveal-up
revealDowntw-reveal-down
expandtw-expand
fadeSlidetw-fade-slide-left
scaleRevealtw-scale-reveal
Curtaintw-curtain

Exit Animations

Function NameCSS Class
fadeOuttw-fade-out
slideUptw-slide-up
slideDowntw-slide-down
slideLefttw-slide-left
slideRighttw-slide-right
zoomOuttw-zoom-out
bounceOuttw-bounce-out
flipOutXtw-flip-out-x
flipOutYtw-flip-out-y
rotateOuttw-rotate-out
rollOuttw-roll-out
lightSpeedOuttw-light-speed-out
collapsetw-collapse
fadeSlidetw-fade-slide-left
Curtaintw-curtain
fadeOutUptw-fade-out-up
puffOuttw-puff-out
vanishOuttw-vanish-out

Attention Animations

Function NameCSS Class
bouncetw-bounce
shaketw-shake
pulsetw-pulse
flashtw-flash
wobbletw-wobble
swingtw-swing
tadatw-tada
jellotw-jello
heartbeattw-heartbeat
blinktw-blink
wavetw-wave
swaytw-sway
rubberBandtw-rubber-band
wiggletw-wiggle
spintw-spin
liquidDriptw-liquid-drip
MagneticPulltw-magnetic
PaperFoldtw-paper-fold
PixelGlitchtw-glitch-pixel
Smoketw-smoke-out
Flaretw-lens-flare
InkSpreadtw-ink-reveal

Effects Animations

Function NameCSS Class
Glowtw-glow
Shadowtw-shadow
neonGlowtw-neon-glow
shimmertw-shimmer
glitchtw-glitch
GlowPulsetw-glow-pulse
Sparkletw-sparkle
Mirrortw-mirror
Auratw-aura
Dusttw-dust
Snaptw-thanos-snap
frostedGlasstw-frosted-glass
rippletw-ripple
hologramtw-hologram
loadCompletetw-load-complete
scrollRevealtw-scroll-reveal
typewritertw-typewriter
letterSpacetw-letter-space

Transform Animations

Function NameCSS Class
scaleUptw-scale-up
scaleDowntw-scale-down
enlargetw-enlarge
shrinktw-shrink
rotatetw-rotate
floatingtw-floating
Teleporttw-teleport
ZigZagtw-zigzag
Orbittw-orbit
PopUpSpintw-popup-spin
UpsideDowntw-upside-down
skewtw-skew
warptw-warp

Hover Animations

Function NameCSS Class
HoverPoptw-hoverpop
HoverShrinktw-hovershrink
HoverEnlargetw-hoverenlarge
HoverShaketw-hovershake
HoverFadetw-hoverfade
HoverGlowtw-hover-glow
HoverShadowtw-hover-shadow
hoverBlurtw-hover-blur
hoverRotatetw-hover-rotate
hoverUnderlineLefttw-hover-underline-left
hoverUnderlineRighttw-hover-underline-right
hoverBorderGlowtw-hover-border-glow
hoverScaleBouncetw-hover-scale-bounce
hoverTilttw-hover-tilt
HoverUpsideDowntw-hover-upsidedown
HoverTeleporttw-hover-teleport
hoverSkewtw-hover-skew
hoverJittertw-hover-jitter

Color Effects

Function NameCSS Class
ColorCycletw-color-cycle
BlackRedtw-black-red
BlackBluetw-black-blue
BlackGreentw-black-green
BlackPurpletw-black-purple
BlackYellowtw-black-yellow
BlackWhitetw-black-white
BlackOrangetw-black-orange
BlackPinktw-black-pink
BlackGraytw-black-gray
BlackCyantw-black-cyan
BlackBrowntw-black-brown
BlackGoldtw-black-gold
BlackSilvertw-black-silver
BlackMagentatw-black-magenta
BlueYellowtw-blue-yellow
DarkGreenLimetw-dark-green-lime
PurpleOrangetw-purple-orange
IndigoPinktw-indigo-pink
GrayCyantw-gray-cyan
DarkBlueWhitetw-dark-blue-white
TealSalmontw-teal-salmon
OliveViolettw-olive-violet
BrownSkyBluetw-brown-sky-blue
MidnightGreenMinttw-midnight-green-mint
CrimsonLemontw-crimson-lemon
SlatePeachtw-slate-peach
CharcoalLavendertw-charcoal-lavender
MaroonMinttw-maroon-mint
DarkCyanGoldtw-dark-cyan-gold
DeepPurpleIvorytw-deep-purple-ivory
ForestPinktw-forest-pink
SteelRosetw-steel-rose
EggplantSuntw-eggplant-sun
rainbowFlowtw-rainbow-flow
heatmaptw-heatmap
textGradientShifttw-text-gradient-shift
ColorPulsetw-color-pulse
Neonflickertw-neon-flicker
PulseMorphtw-pulse-morph
GradientWavetw-gradient-wave
ColorExpandtw-color-expand
RotateHuetw-hue-scale
ColorBounceBallstw-bounce-color
ColorPoptw-color-pop
LiquidMetaltw-liquid-metal

Changelog:

v1.5.9 (08/24/2025)

  • added phy related animations

v1.5.8 (07/20/2025)

  • 150+ new animations added
  • Class-based usage support
  • Bug Fixes

You Might Be Interested In:


Leave a Reply