Bring your interfaces to life with these JavaScript animation examples. This collection showcases interactive transitions, motion effects, and engaging sequences built with plain JavaScript or popular libraries such as GSAP and anime.js.
42 JavaScript Animations
Interactive Canvas Particle Image Effect
demo & codeThis is an Interactive Canvas Particle Image Effect. It reconstructs standard raster images using thousands of autonomous floating particles. Its function is to create a highly tactile visual experience that reacts to cursor proximity, morphing colors based on hidden alternate image data to remove the static barrier between user and interface.
Interactive Physics-Based Dot Grid
demo & codeThis is an Interactive Physics-Based Dot Grid. It transforms a static matrix of circular DOM elements into a reactive, liquid-like surface. Its function is to provide an engaging, high-end visual toy or background element where the dots elastically pull toward the user’s cursor on hover, and dramatically explode outward with gravity-based physics upon clicking.
Mouse-Reactive Floating Image Gallery
demo & codeThis is a Mouse-Reactive Floating Image Gallery. It places an oversized grid of visual assets behind the viewport, hidden by the overflow. Its function is to provide an immersive, explorative navigation experience where the user’s cursor physically steers the scene across a scattered landscape of content.
Animated SVG Penrose Triangle Loader
demo & codeThis is an Animated SVG Penrose Triangle Loader. It combines the impossible geometry of the Penrose triangle with a continuous circular spinner to create a hypnotic, high-fidelity loading animation. Its function is to provide a visually stunning and technically impressive waiting state for applications, using SVG filters and GSAP to add depth and motion.
PixiJS Procedural GLSL Flame
demo & codeThis is a PixiJS Procedural GLSL Flame. It generates a hyper-realistic, endlessly animating flame entirely through mathematical functions inside a fragment shader. Its function is to provide a high-performance visual effect without relying on video files or sprite sheets, using procedural noise to simulate the chaotic turbulence of a real fire.
Cinematic Zoom Blur Image Gallery
demo & codeThis is a Cinematic Zoom Blur Image Gallery. It utilizes custom GLSL fragment shaders and Three.js to create a high-fidelity transition between image textures. Its function is to provide an immersive navigational layer for visual portfolios, where spatial depth and radial blur replace standard linear crossfades.
Minimalist Canvas Animated Particle Background
demo & codeThe Minimalist Canvas Animated Particle Background is an ambient UI element that generates a field of drifting geometric shapes. It serves as a non-intrusive aesthetic layer for headers or landing pages, providing depth through motion. The system alternates between “bubbles” and spinning “lines” to create a technical yet organic atmosphere.
Animated Star Toggle Switch
demo & codeThis is an Animated Star Toggle Switch. It replaces a standard HTML checkbox with a highly expressive, character-driven micro-interaction. Its function is to provide emotional feedback to a binary choice (like “favorite” or “bookmark”), launching the star into the air where it physically morphs between a sad, grey orb and a happy, bright yellow star.
Shattering Image Gallery Transition
demo & codeThis is a Shattering Image Gallery Transition. It utilizes the WebGL API via Three.js to deconstruct 2D images into a matrix of 3D particles. Its function is to replace standard fade or slide slideshows with a highly cinematic, physics-based explosion effect, transitioning between photographs by blowing the current image apart to reveal the next one underneath.
Staggered Particle Blob Effect
demo & codeThis is a Staggered Particle Blob Effect. It clusters multiple DOM nodes into a cohesive, glowing entity that tracks cursor movement. Its function is to provide highly organic, procedural background interaction, replacing static canvases with an ecosystem of independent, mathematically linked elements.
Infinite 3D Poster Scroll Wall
demo & codeThis is an Infinite 3D Poster Scroll Wall. It constructs a dense, continuous grid of cinematic assets rendered entirely in WebGL. Its function is to provide a visually overwhelming, highly performant “hero” background that automatically fetches live data from an external API and perpetually scrolls along a tilted perspective plane.
Isometric 3D Bouncing Cube Animation
demo & codeThis is an Isometric 3D Bouncing Cube Animation. It utilizes the Zdog.js engine to render a pseudo-3D geometric scene onto a flat HTML Canvas. Its function is to provide an engaging, continuous background animation where a wandering cube paints a trail across a structural grid, adding depth and kinetic energy to otherwise static hero sections.
Interactive Download Folder Animation
demo & codeThis is an Interactive Download Folder Animation. It replaces a static download button with a lively, physics-based micro-interaction. Its function is to provide immediate, satisfying visual confirmation of a user action. The effect drops a new document into a stacked folder, triggering a synchronized elastic bounce across multiple UI layers.
Interactive Spectral 3D Ghost Effect
demo & codeThis is an Interactive Spectral 3D Ghost Effect. It utilizes Three.js and custom GLSL shaders to render a dynamic, mouse-tracking entity with analog signal decay. Its function is to serve as an immersive focal point or an interactive background element. The effect effectively bridges direct user input with procedural visual storytelling.
Animated Coffee Cup Sticker
demo & codeIn the sterile world of web interfaces, a touch of whimsy can be the difference between a user forgetting your site and remembering it with a smile. This snippet isn’t just an animation; it’s a digital sticker with a soul. It brings the static ritual of coffee to life through squash-and-stretch principles, transforming a simple icon into a living character that breathes, reacts, and delights.
Fluid Morphing List Expansion
demo & codeMost interfaces treat layout changes as abrupt cuts in a film — jarring and disconnected. We reject this. UI should behave like matter, conserving momentum and mass. This component demonstrates the “impossible”: animating a flexbox container from a horizontal row to a vertical column seamlessly. It creates a sense of spatial continuity that makes the application feel not like software, but like a living organism adapting to user intent.
Interactive Emotional Feedback Slider
demo & codeForms are traditionally cold and utilitarian. This component challenges that norm by injecting emotional intelligence into the user interface. By mapping a range slider to animated character states, we transform a simple data input into a conversation. It turns the abstract concept of “satisfaction” into a relatable, human narrative, encouraging users to engage more deeply with the feedback process.
GSAP SVG Circle Unwrapping Animation
demo & codeThis GSAP SVG Circle Unwrapping Animation is a masterclass in visual sleight of hand. Instead of mathematically morphing a curved path into a straight line (which often results in distorted, unappealing stroke widths), this component creates a seamless illusion. It splits a circle into two halves and synchronizes their movement with a dynamically generated straight line, making it appear as though the circle is being physically unrolled or “unwrapped” like a ribbon.
Photo Inview Animation: Venetian Blinds Effect
A high-end, editorial-style web design where content appears smoothly and coordinately, creating a sense of premium quality and attention to detail.
See the Pen Photo Inview Animation: Venetian Blinds Effect.
Air Balloon Cruise
A soothing dreamscape scene with smooth, infinite animation resembling a live postcard or a splash screen for a meditation app.
See the Pen Air Balloon Cruise.
Bongo Cat Codes #2: Jamming
A playful recreation of the Bongo Cat meme using SVG and GSAP. It features complex timelines coordinating rapid paw movements, a randomized note particle system colored via CSS variables, and a scrolling terminal code effect using drawSVG logic.
See the Pen Bongo Cat Codes #2: Jamming.
Disney+ Logo Animation
A cinematic, fluid intro identical to a streaming service splash screen, featuring glow effects, particles, and morphing to create a sense of magic and high-budget production.
See the Pen Disney+ Logo Animation.
Day and Night Toggle with SVG Animation
An atmospheric day/night toggle where a minimal JavaScript classList.toggle trigger activates a cinematic transition across complex SVG layers. The scenery leverages linear-gradient masking and mix-blend-mode for dynamic lighting, while long-duration CSS transform properties orchestrate a seamless, parallax-like shift between solar and lunar states.
See the Pen Day and Night Toggle with SVG Animation.
GSAP Flip Plugin Demo
This demo is a showcase of GSAP’s Flip plugin, a powerful tool for animating layout changes. The Flip.getState() and Flip.from() methods are used to seamlessly transition between four different CSS layouts, creating a complex and fluid morphing animation with minimal code.
See the Pen GSAP Flip Plugin Demo.
Interactive GSAP Collage Animation
This interactive digital collage is driven by a single, reversible gsap.timeline that animates dozens of absolutely positioned <img> elements into a cohesive illustration on hover. A key feature is the sophisticated text reveal, powered by GSAP’s SplitText plugin, which creates a fluid ‘waterfall’ effect. The entire composition is built to be fully responsive, using a custom SCSS --unit variable based on vmin to ensure the complex layout scales proportionally.
See the Pen Interactive GSAP Collage Animation.
Animated Camera Along a Path with Three.js
A modern Three.js setup using importmap to work with modules without a bundler - plus custom post-processing passes to create speed and glow effects.
See the Pen Animated Camera Along a Path with Three.js.
Animated SVG Color Wave Effect
Technical relevance: the use of GSAP to control strokeDashoffset on the mask with looping and different easing, - resulting in a stylized “wave” effect gliding over complex, pre-defined SVG Bézier curves.
See the Pen Animated SVG Color Wave Effect.
Rain Particle Effect with HTML Canvas
This full-screen particle system uses the Canvas 2D context to draw short-lived, low-alpha rain streaks, relying on requestAnimationFrame for a performance-optimized background animation.
See the Pen Rain Particle Effect with HTML Canvas.
Dynamic Twinkling Particle System with Vanilla JS and Canvas
Dive into an interactive demo using pure JavaScript and Canvas 2D, where mouse movement creates a magnetic field for particles, and clicking triggers an explosion effect, implementing complex element creation and destruction logic.
JFK Speech Text Wave Animation
Dynamic visualization of John F. Kennedy’s speech, where each word is a separate element, creating a “running wave” effect using CSS transformations and a JavaScript setInterval.
See the Pen JFK Speech Text Wave Animation.
GSAP Homepage Demo 4
An advanced interactive gallery showcasing the power of GreenSock: it utilizes custom Timelines to manage complex, multi-stage animations and x, y, scale transformations upon clicking the elements.
See the Pen GSAP Homepage Demo 4.
Zdog Rainbow 🌈 (3D Graphics)
Explore lightweight 3D graphics using the Zdog library to render a vibrant, drag-rotatable isometric rainbow and clouds, demonstrating efficient pseudo-3D rendering for web UIs.
See the Pen Zdog Rainbow 🌈 (3D Graphics).
GSAP 3 Animation Deck with 3D Transforms
A demo of multi-step animations using keyframes within GSAP, plus subtle work with CSS filters (brightness) to simulate 3D object lighting.
See the Pen GSAP 3 Animation Deck with 3D Transforms.
Card Beam Animation Effect
Implemented motion physics for an interactive carousel: uses an requestAnimationFrame loop for smooth movement and applies an inertia effect after dragging (Drag/Touch) by gradually decaying this.velocity with friction (this.friction).
See the Pen Card Beam Animation Effect.
Rainbow Loop Animation (Click to Pause)
This is an example of efficient animation composition using gsap.timeline, which synchronizes independent motion phases (.from() and .to()) of multiple <path> elements to create one complex loop.
See the Pen Rainbow Loop Animation (Click to Pause).