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. Inversion Lens Hover

Inversion Lens Hover

PreviousNext

A three.js shader lens that follows the cursor and flips the image to inverted grayscale inside a circle with a turbulent, animated edge.

Open in
inversion-lens-hover-demo
components/ui/inversion-lens-hover-demo.tsx
import { InversionLensHover } from "@/registry/tween/inversion-lens-hover"

export function InversionLensHoverDemo() {
  return <InversionLensHover />
}

Installation

pnpm dlx shadcn@latest add https://tweenui.dev/r/inversion-lens-hover.json

Usage

import { InversionLensHover } from "@/components/ui/inversion-lens-hover"
<InversionLensHover
  image="https://example.com/portrait.jpg"
  alt="Portrait lit by a single warm light"
  maskRadius={0.2}
/>

How it works

  • A container-sized WebGL canvas draws the image on a full-screen plane, fitted to the image's height.
  • The fragment shader measures each pixel's aspect-corrected distance to the cursor and adds eight octaves of value-noise turbulence that scrolls over time, so the circle's edge boils.
  • Inside the lens the pixel becomes inverted grayscale; outside it keeps its original color.
  • The cursor position is lerped by lerpFactor, and the lens grows to maskRadius on enter and shrinks to zero on leave at radiusLerpSpeed.
  • Pointer listeners live on the component. An IntersectionObserver pauses rendering while it is off-screen. Everything is disposed on unmount.
  • With prefers-reduced-motion: reduce, the image renders once without the lens.

Props

PropTypeDefaultDescription
imagestringremote photoImage shown full-bleed.
altstringdefaultAccessible label for the image.
maskRadiusnumber0.15Lens radius relative to the container height.
maskSpeednumber0.75Speed of the turbulent edge animation.
lerpFactornumber0.05How quickly the lens follows the cursor.
radiusLerpSpeednumber0.1How quickly the lens grows and shrinks.
turbulenceIntensitynumber0.075How jagged the lens edge is.
classNamestring—Extra classes on the outer container.
Fluid Gradient CanvasCircular Widgets

On This Page

InstallationUsageHow it worksProps

Contribute

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