tween
ComponentsTemplatesShowcaseContact

Command Palette

Search for a command to run...

Getting Started
  • Introduction
  • Installation
  • StoryNew
Guides
  • Motion Principles
  • Scroll and Smooth Scroll
  • Performance and Accessibility
Scroll Animations
  • Sticky Cards Scroll
  • Rise Fan Cards Scroll
  • Rotate Stack Scroll
  • Doodle Lens ScrollNew
  • Slit Open Hero ScrollNew
  • Logo Mask Zoom ScrollNew
  • ASCII Dissolve ScrollNew
  • Lottie Flight ScrollNew
  • Inline Icon Text ScrollNew
  • Starfield ScrollNew
  • Name Swap ScrollNew
  • Spotlight Gallery HeroNew
  • Slit Rotate Hero ScrollNew
  • Stroke Cover ScrollNew
  • Stroke Rows ScrollNew
Text Animations
  • Text Skew Reveal
  • Block Text Reveal
Hover & Cursor
  • Image Trail Cursor
  • Cursor Depth Logo
  • Physics Tag Drop
  • Elastic Card ListNew
  • Magnetic Cards SpringNew
Sliders & Carousels
  • Wheel Fullscreen Carousel
  • Ripple Displacement Slider
  • Three.js Blend Slider
  • Stacked Deck Slider
  • Orbit Cylinder SliderNew
  • Fan Stack SliderNew
  • Exponential Strip SliderNew
  • Dual Column SliderNew
Galleries & Grids
  • Scroll Wave Gallery
Menus & Navigation
  • Shrink Page MenuNew
Preloaders & Intros
  • Floating Items RevealNew
  • Word Cycle RevealNew
  • Tile Grid LoaderNew
Page Transitions
  • Panel Assembly TransitionNew
3D & WebGL
  • Fractal Glass Hero
  • Fluid Cursor Canvas
  • Fluid Portrait Hero
  • Fluid Gradient Canvas
  • Inversion Lens HoverNew
UI Elements
  • Circular Widgets
  • Vinyl Cover
  • Image Explosion Footer
  • Accordion Image FramesNew

(Tween) — Motion registry

Animated components & full sites, one command away.

Product

  • Components
  • Templates
  • Installation
  • Guides
  • Blog
  • Contact

Categories

  • Scroll Animations
  • Text Animations
  • Hover & Cursor
  • Sliders & Carousels
  • Galleries & Grids
  • Menus & Navigation
  • Preloaders & Intros
  • Page Transitions
  • 3D & WebGL
  • UI Elements
TWEEN
ease: power2.inOut0.00s
© 2026 TweenBack to topBuilt by mohammad
  1. Docs/
  2. Components/
  3. Fluid Gradient Canvas

Fluid Gradient Canvas

PreviousNext

A self-contained WebGL canvas that renders a flowing four-color plasma gradient and warps it through a cursor-driven feedback-buffer fluid simulation.

Open in
fluid-gradient-canvas-demo
Solenne LabsStudies · Archive · Contact
Study 0712 — AfterglowMove to stir the light
components/ui/fluid-gradient-canvas-demo.tsx
import { FluidGradientCanvas } from "@/registry/tween/fluid-gradient-canvas"

export function FluidGradientCanvasDemo() {
  return (
    <FluidGradientCanvas>
      <div className="pointer-events-none absolute inset-0 flex flex-col justify-between p-[clamp(1.25rem,4cqi,2rem)] font-mono text-[clamp(0.6rem,1cqi,0.75rem)] tracking-[0.18em] text-white/90 uppercase">
        <div className="flex items-center justify-between">
          <span className="flex items-center gap-2 font-sans text-base font-bold tracking-normal">
            <svg
              width="20"
              height="20"
              viewBox="0 0 24 24"
              fill="none"
              aria-hidden
            >
              <circle
                cx="12"
                cy="12"
                r="10"
                stroke="currentColor"
                strokeWidth="2"
              />
              <path d="M2 12a10 10 0 0 0 20 0Z" fill="currentColor" />
            </svg>
            Solenne Labs
          </span>
          <span>Studies · Archive · Contact</span>
        </div>
        <div className="flex items-center justify-between">
          <span>Study 0712 — Afterglow</span>
          <span>Move to stir the light</span>
        </div>
      </div>
    </FluidGradientCanvas>
  )
}

Installation

pnpm dlx shadcn@latest add https://tweenui.dev/r/fluid-gradient-canvas.json

Usage

import { FluidGradientCanvas } from "@/components/ui/fluid-gradient-canvas"
<FluidGradientCanvas
  color1="#f2b48c"
  color2="#4a1236"
  color3="#ff4b1f"
  color4="#ff9a5a"
>
  <h1 className="absolute inset-0 grid place-items-center text-white">
    Solenne Labs
  </h1>
</FluidGradientCanvas>

Two ShaderMaterial passes run every frame on a fullscreen plane. The fluid pass reads its own previous frame from a ping-ponged float render target and advects a velocity field; the cursor injects velocity along its travel path, scaled by brushSize and brushStrength, and decays via fluidDecay, trailLength, and stopDecay. The display pass generates a four-color plasma from the four color* props and offsets its lookup by the fluid velocity (distortionAmount), so the gradient ripples wherever the pointer has moved.

The renderer is sized to the container, pointer tracking is bound to the component element (never the window), and a ResizeObserver resizes the targets on layout changes. Anything passed as children renders above the canvas. When prefers-reduced-motion: reduce is set, a single static frame is rendered and the cursor interaction is disabled.

Props

PropTypeDefaultDescription
brushSizenumber25Radius of the cursor's influence on the fluid.
brushStrengthnumber0.5How forcefully the cursor injects velocity.
distortionAmountnumber2.5How much the fluid velocity warps the gradient lookup.
fluidDecaynumber0.98Per-frame velocity decay (lower = shorter wake).
trailLengthnumber0.8Persistence of the velocity trail.
stopDecaynumber0.85Extra decay applied near a stationary cursor.
color1–color4stringafterglowThe four hex colors blended into the gradient.
colorIntensitynumber1Output color multiplier.
softnessnumber1Flattens the gradient mixers toward an even blend.
classNamestring—Extra classes on the canvas container.
Fluid Portrait HeroInversion Lens Hover

On This Page

InstallationUsageProps

Contribute

  • Report an issue
  • Request a feature
  • Edit this page