
The colour columns
Hover, SVG
The card of a made-up stock, in the clean style of finance apps: the price line draws itself, a thin crosshair follows the pointer with its point on the line, the date and price tag arrives a moment later, the big price rolls digit by digit and the change turns green or red against the dashed starting line. 1D, 1W and 1M fold the line into the new one.
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>
<!--
"Stock chart crosshair" 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 stock chart with a crosshair that follows the pointer</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 card of a made-up stock, Ostrin Labs: the price line draws itself, a crosshair follows the pointer,
the big price rolls to the value under it and the change turns green or red against the opening price -->
<article class="card" data-card aria-label="Ostrin Labs stock">
<header class="card__head">
<div class="co">
<span class="co__logo" aria-hidden="true">
<svg viewBox="0 0 24 24"><path d="M12 3.5 19.4 8v8L12 20.5 4.6 16V8Z"/><path d="M12 3.5v17"/><path d="m4.6 8 7.4 4.3L19.4 8"/></svg>
</span>
<span class="co__text">
<span class="co__name" data-name>Ostrin Labs</span>
<span class="co__tick" data-ticker>OSTR</span>
</span>
</div>
<div class="tabs" role="tablist" aria-label="Range">
<span class="tabs__pill" data-pill aria-hidden="true"></span>
<button class="tabs__tab is-on" type="button" role="tab" aria-selected="true" data-range="d">1D</button>
<button class="tabs__tab" type="button" role="tab" aria-selected="false" data-range="w">1W</button>
<button class="tabs__tab" type="button" role="tab" aria-selected="false" data-range="m">1M</button>
</div>
</header>
<div class="quote">
<div class="price" data-price aria-live="polite">
<span class="price__cur">$</span><span class="price__digits" data-digits></span>
</div>
<div class="change" data-change>
<svg class="change__tri" data-tri viewBox="0 0 10 10" aria-hidden="true"><path d="M5 2.2 8.6 7.6H1.4Z"/></svg>
<span data-change-text>+0.00 (0.00%)</span>
<span class="change__when" data-when>Today</span>
</div>
</div>
<div class="chart" data-chart>
<svg class="chart__svg" data-svg viewBox="0 0 400 170" preserveAspectRatio="none" aria-hidden="true">
<defs>
<linearGradient id="area-fill" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="currentColor" stop-opacity="0.16"/>
<stop offset="1" stop-color="currentColor" stop-opacity="0"/>
</linearGradient>
<clipPath id="lit"><rect data-lit x="0" y="-10" width="400" height="190"/></clipPath>
</defs>
<g class="chart__grid" data-grid></g>
<line class="chart__open" data-open x1="0" x2="400" y1="80" y2="80"/>
<path class="chart__dim" data-dim d=""/>
<g clip-path="url(#lit)">
<path class="chart__area" data-area d=""/>
<path class="chart__line" data-line d=""/>
</g>
<g class="hair" data-hair>
<line class="hair__v" data-hair-v x1="0" x2="0" y1="0" y2="170"/>
</g>
</svg>
<span class="hair__dot" data-dot aria-hidden="true"></span>
<div class="tag" data-tag aria-hidden="true">
<span class="tag__price" data-tag-price>$0.00</span>
<span class="tag__date" data-tag-date>9:30 AM</span>
</div>
<span class="chart__openlab" data-openlab>Open</span>
</div>
<dl class="stats">
<div><dt>Open</dt><dd data-s-open>0</dd></div>
<div><dt>High</dt><dd data-s-high>0</dd></div>
<div><dt>Low</dt><dd data-s-low>0</dd></div>
<div><dt>Volume</dt><dd data-s-vol>0</dd></div>
</dl>
</article>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></svg>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="script.js"></script>
</body>
</html>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.
34 values to change
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 “Stock chart crosshair” from Animorio and fit it into my siteEach range has 64 made-up prices, built from a trend, a sine dip and a damped noise with a fixed-seed generator, so the chart is always the same. Each range has its own scale: the prices become coordinates of a 400 by 170 viewBox, with some air above and below.
The same line is drawn twice: below in grey, above in the state colour with the gradient, inside a clipPath. The clipPath rectangle is as wide as the crosshair’s x, interpolated by a value going from 0 to 1 when the crosshair enters, so the right part fades out and back in.
The crosshair’s x is a number chased by gsap.quickTo in 0.12 seconds; on every frame GSAP’s ticker reads the y on the line by interpolating between the two nearest points and puts the point there. The tag has two quickTo of its own, slower (LAG), and switches side when it would touch the edge.
The big price is made of five columns of digits from 0 to 9 under a faded mask. Each column has its own quickTo on yPercent: when the price under the crosshair changes by a cent, each one rolls to its digit, and while scrubbing the columns chase the value without stopping.
The white pill slides under the chosen tab with back.out. The line is not redrawn: a tween on a number from 0 to 1 interpolates every y from the old chart to the new one and rebuilds the path on every frame, and the dashed starting line does the same.
| Name | File | Default | What it changes |
|---|---|---|---|
NAME | script.js | 'Ostrin Labs' | The name of the made-up company, top left. |
TICKER | script.js | 'OSTR' | The stock’s ticker, under the name. |
OPEN_PRICE | script.js | 182.4 | Today’s opening price: the dashed line of the one-day chart. |
UP | script.js | '#0f9d6b' | The colour when the price under the crosshair is above the starting one. |
DOWN | script.js | '#e0484d' | The colour when the price under the crosshair is below the starting one. |
LAG | script.js | 0.45 | The seconds the date and price tag takes to catch up with the crosshair. |
MORPH | script.js | 0.8 | The seconds the line takes to fold into the new one when you switch 1D, 1W, 1M. |
PAUSE | script.js | 1.1 | The seconds the autopilot rests on the points it shows. |
For a finance or investing app, a dashboard with numbers changing over time, or a product page showing a trend: the chart is read with a finger and the big number always tells the value of the point you are looking at.
The same animation with adapted sizes: the card and the chart are sized on the width and the height, a finger dragged over the chart moves the crosshair like the pointer and the 1D, 1W, 1M tabs stay beside the name.
The line is already there, without drawing itself; the crosshair and the tag follow at once without lag, the digits change without rolling and switching the range is a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.8 KB; the libraries: GSAP 28 KB.
Tested on 27 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.