axi0motion

Lens warp

A lens follows the pointer and swells the letters under it, with red and blue fringes at its rim; at rest it drifts across on its own.

  • enhancer
  • canvas
  • pointer
  • distortion
  • since 0.2

Background Studio: tune it below, then copy the code

Your system asks for reduced motion: the demo shows its final state and nothing moves.

Live demo

Lens warp example

Bend the moment

Controls

1.3 em
0.5

Code

It follows the controls above: change an option and the code changes with it.

<link rel="stylesheet" href="/axi0/motion/motion.css?v=6">
<script src="/axi0/motion/motion.js?v=10" defer></script>

<p class="demo-num" data-motion="lens-warp">Bend the moment</p>

The wrappers: LensWarp.tsx (React, TypeScript) and LensWarp.vue (Vue). Both render the same attributes as the HTML; the loader does the rest.

Options

AttributeDefaultWhat it does
data-motion-size1.3Lens radius
data-motion-strength0.5How much it swells
data-motion-idletrueDrift on its own when nobody points
data-motion-color1#ff2e63First fringe
data-motion-color2#08d9d6Second fringe

Accessibility

The words stay real, selectable text in their places (painted transparent while the canvas shows them) and the canvas is aria-hidden, so readers hear the text once and nothing reflows. Reduced motion shows the plain text. The frame loop stops off screen and in hidden tabs, and without the idle drift it stops once the lens has faded.

Size

lens-warp.js is 1.8 KB gzip, with text-kit.js 2.6 KB it needs. A page loads the loader (2.7 KB) and core.js (1.4 KB) once, whatever it uses.