UI Micro-interactions
Inverted Reading Glass
A white circular lens tracks the cursor using mix-blend-mode:difference, inverting text colors beneath it to reveal near-invisible dark text on black.
csslight complexitysubtle motionpointermobile-ready
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
1
When to use it
Hero sections with hidden or low-contrast text that rewards exploration. Interactive art installations or editorial reveals.
When not to
Contexts requiring legible text without interaction. Touch drag explores the lens; reduced motion reveals all text and moves the lens without easing.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the lens size from clamp(150px, 20vw, 250px) to clamp(80px, 12vw, 140px) and set the lerp factor from 0.15 to 0.08 for a heavier lag effect.
Safe to edit
- lens diameter (clamp(150px, 20vw, 250px))
- lerp smoothing factor (0.15)
- text content (.text-content span)
- text base color (#333333)
- auto-orbit radius multiplier (0.1)
Keep intact
- mix-blend-mode: difference on .lens
- IIFE wrapper
- visibilitychange stop/start
- prefersReducedMotion guard
- demo-v1 preview lifecycle: initialize demoEnabled from window.__foreverPreview and stop attract work on the window forever:interactive event; retain manual feedback, settling, cleanup and explicit sessions
Known limitations
- Text is nearly invisible without interaction — not accessible as standalone content
- Reduced motion reveals all text; deliberate input moves the lens immediately without ambient motion.
- Auto-orbit loop runs a second rAF loop alongside animate() — two concurrent rAF chains
- State remains local to each mounted instance; format/theme remount preserves takeover, not component values.
More UI Micro-interactions components
- Add to Cart FlyNative Add button flings a product clone into a cart; first input cancels unfinished attract flights, while each manual action keeps its full 680ms flight…
- Notification BellSVG bell swings and rings with a ripple wave on click; a red badge counter pops in with a springy bounce and increments each ring. Auto-cycles every 2…
- Copy ConfirmCopy icon morphs to a drawn-stroke checkmark with a green button flash and a "Copied!" toast on click; auto-cycles as a demo loop.
- Swipe Card StackTinder-style draggable card stack — drag the top card left/right to reveal NOPE/LIKE stamps; fling-away animates it off-screen and cycles to the next card.
- Pull to RefreshA phone-frame list supports pointer/touch pull and a native Refresh button. First input stops attract refreshes; manual refresh completes its spinner, row…
- Accordion ExpandThree FAQ panels smoothly expand and collapse with a CSS height transition; a chevron rotates 180 degrees to indicate open state. Auto-cycles as demo.