Skip to content
animorio
IT
Back to the library

Anamorphic plan card

WebGL, HoverWebGL, GSAPMediumCompressed weight: Demo 8.0 KBGSAP 28 KBFreeDownload the zip

A minimal WebGL animation: the Pro plan card of an AI image app, dark on a near black page, crossed by the light of an anamorphic lens, the kind that squeezes a bright point into one long horizontal line. A single white thread with a blue haze, a 2D shader that follows the pointer on a spring, the card's edge lighting up only where it touches it and the price catching the light as it passes. Pressing Upgrade the light flares wide for an instant.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Anamorphic plan card" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The plan card with the anamorphic light</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the Pro plan card of an AI image tool. Behind its words a WebGL shader draws the light of an anamorphic lens:
         one thin horizontal streak, long and blue, with a small bloom where it starts, two faint ghosts on the other
         side of the card and the edge of the card catching it. The streak follows the pointer on a spring -->
    <div class="plan" data-plan>
      <canvas class="plan__light" data-canvas aria-hidden="true"></canvas>
      <span class="plan__flare" data-flare aria-hidden="true"><span class="plan__flare-line"></span></span>
      <article class="plan__card" data-card>
        <header class="plan__head">
          <span class="plan__name">Pro</span>
          <span class="plan__chip">Most chosen</span>
        </header>
        <p class="plan__price"><span class="plan__amount" data-amount>$24</span><span class="plan__per">/ month</span></p>
        <p class="plan__line">Unlimited renders, 4K upscale and the priority queue for Halden Studio.</p>
        <span class="plan__rule" aria-hidden="true"></span>
        <button class="plan__btn" type="button" data-btn>
          <span class="plan__btn-face" data-face>
            <span class="plan__btn-words" data-words>Upgrade to Pro</span>
            <svg class="plan__btn-icon" viewBox="0 0 16 16" aria-hidden="true">
              <path class="plan__arrow" data-arrow d="M3 8h9M8.5 4.2L12.3 8 8.5 11.8"/>
              <path class="plan__check" data-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/>
            </svg>
          </span>
        </button>
      </article>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

23 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Anamorphic plan card” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a near black page a dark card with round corners rises slowly: at the top ‘Pro’ and a small ‘Most chosen’ label, then the big price ‘$24 / month’, a line saying what it includes, a thin rule and the light ‘Upgrade to Pro’ button with its arrow. From the left a horizontal line of light comes in, very thin, with a white core and a blue haze that fades along both sides: it is the flare of the anamorphic lenses of cinema. Where it starts there is a small oval bloom; on the other side of the card, mirrored through the middle, two faint ghosts follow it; the card's edge lights up only at the two points where the line meets it, and outside the card the light goes on over the page at a third of its strength. Passing over the price the figures brighten at exactly that height. The light moves down onto the line of text, then settles on the rule over the button, which becomes a lit line; there the button is pressed: it gives under the finger and comes back on a spring, the light flares wide and thick for an instant, the label turns into ‘You are on Pro’ and the arrow makes way for a checkmark that draws itself. Then the light leaves at the top right and the loop starts again. With the pointer the light follows it on a spring that passes the mark by a pixel and settles, and the button can really be pressed.

How it works

One triangle over the canvas

The light is a WebGL shader on a single triangle covering a canvas a little wider than the card, centred on it, so the line can go past the edges. Underneath is the card's body (a layer of its own), on top the words and the button.

The anamorphic line

The core is a very narrow vertical gaussian (1.3 px) times a horizontal exponential half the card long; the haze is the same, wider and shorter. The core cubed turns white, the rest takes the blue from the CSS. A slow sine makes it breathe along the line.

Ghosts, edge and outside

Two faint ovals sit opposite the source through the middle, as in real lenses. The signed distance from the card's rounded rectangle lights the edge only at the line's height, and outside the card the light drops to a third and fades over 46 px.

A spring for the source

The source chases the pointer (or the walk on its own, a GSAP timeline) on a spring integrated by hand, stiffness 170 and damping 17, in two steps per frame: it passes the mark by a pixel and settles. The intensity has its own spring too.

The price and the press

The price is text with a clipped background: a vertical gradient whose bright band sits at the line's height, moved every frame with a CSS variable. On a press a timeline takes the pressure to 1 in 0.12 s and back to zero in 1.3 s: the line gets two and a half times longer and thicker.

Values to change

NameFileDefaultWhat it changes
LENGTHscript.js0.55How long the line is, as a share of the card's width.
THICKNESSscript.js1.3The thickness of the white core, in pixels.
GLOWscript.js1How bright the light is.
GHOSTSscript.js0.6How visible the two ghosts on the other side are.
SPILLscript.js0.32How much light spills past the card onto the page.
STIFFNESSscript.js170The spring pulling the light to the pointer: higher is quicker.
DAMPINGscript.js17Lower lets the light pass the mark and come back.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the light's walk.

Try them in the Playground

When to use it

For the pricing page of an AI app, a video or photo tool, a SaaS service: the recommended plan card that has to draw the eye without shouting.

On phones

The same animation with adapted sizes: the card is as wide as the box allows, the margins shrink with the height, the light spills sideways only as far as there is room, and a finger takes it where it touches.

With reduced motion

The light does not move: it stays still at the price's height and fades in and out; pressing the button, the label and the checkmark change with a fade.

Pitfalls

  • The card's body has to sit under the canvas and the words over it: that is why the background is a separate pseudo-element, otherwise the light either covers the text or stays hidden.
  • With premultipliedAlpha the alpha must be at least the strongest colour, or the colours burn out: here the alpha is the largest of the three channels.
  • An opaque button hides the light passing under it: the walk stops on the rule above the button, not on the button.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.0 KB; the libraries: GSAP 28 KB.

Testing

Tested on 1 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations