
The star rating
Ratings, SVG, Hover
The «Plant a tree» button of an invented climate app, Rootwell, in near-black green lacquer on white, like a Dribbble shot: the cream knob holds a little window onto the soil, seen in cross-section, with a seed resting on top. On tap the seed hops and drops into the soil kicking up a little dust, roots reach down below, the sprout pushes up above bent like a hook, straightens and opens two leaves on a spring, then a bud; forest green fills the pill from the knob, it says Tree planted, and the trees planted counter rolls up by one, digit by digit, while the goal line moves on. The sprout sways in the breeze, then bows back into the soil and a new seed falls in.
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>
<!--
"Plant a tree button" 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 Plant a tree button with the sprout growing in the pill</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>
<!-- a climate app: tap the pill, the seed drops into the soil window of the knob,
roots reach down, the sprout pushes up as a hook, straightens and opens two leaves,
the pill turns forest green and the trees counter rolls up by one -->
<div class="plot" data-plot>
<p class="plot__top">
<span class="plot__brand">Rootwell</span>
<span class="plot__where">Alder Ridge · native oak</span>
</p>
<button class="plant" type="button" data-plant data-autoclic aria-pressed="false">
<span class="plant__green" data-green aria-hidden="true"></span>
<span class="plant__sheen" data-sheen aria-hidden="true"></span>
<span class="plant__knob" data-knob aria-hidden="true">
<svg class="pot" viewBox="0 0 48 48">
<defs>
<clipPath id="tondo"><circle cx="24" cy="24" r="24"/></clipPath>
<clipPath id="sotto"><rect x="0" y="32.6" width="48" height="16"/></clipPath>
<linearGradient id="terra" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#7a5536"/>
<stop offset="0.45" stop-color="#5b3d25"/>
<stop offset="1" stop-color="#3a2717"/>
</linearGradient>
<linearGradient id="foglia-s" x1="1" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#9be08a"/>
<stop offset="0.55" stop-color="#4fb35e"/>
<stop offset="1" stop-color="#2d7f43"/>
</linearGradient>
<linearGradient id="foglia-d" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#a8e892"/>
<stop offset="0.5" stop-color="#58bd63"/>
<stop offset="1" stop-color="#2f8546"/>
</linearGradient>
<radialGradient id="seme" cx="0.35" cy="0.3" r="0.8">
<stop offset="0" stop-color="#e9c48e"/>
<stop offset="0.6" stop-color="#b9864d"/>
<stop offset="1" stop-color="#7b5228"/>
</radialGradient>
</defs>
<g clip-path="url(#tondo)">
<g data-soil>
<path class="soil" d="M-2 33.4C8 32.2 16 33.6 24 33 32 32.4 40 33.6 50 32.8V50H-2Z"/>
<path class="soil__edge" d="M-2 33.4C8 32.2 16 33.6 24 33 32 32.4 40 33.6 50 32.8"/>
<g class="soil__grit">
<ellipse cx="9" cy="38.5" rx="1.3" ry=".8"/>
<ellipse cx="36.5" cy="41" rx="1.6" ry=".9"/>
<ellipse cx="17" cy="44" rx="1" ry=".6"/>
<ellipse cx="31" cy="36.6" rx=".8" ry=".5"/>
<ellipse cx="41" cy="36" rx=".7" ry=".45"/>
</g>
<g clip-path="url(#sotto)">
<path class="root" data-root d="M24 36.6C23.4 39.4 21.6 41.2 19.8 44.6"/>
<path class="root" data-root d="M24.3 36.8C25.4 39.8 27.6 41.4 28.6 45.4"/>
<path class="root root--fine" data-root d="M24 37C24.2 40.2 23.6 43 24.4 47"/>
<path class="root root--fine" data-root d="M21.6 41.6C20.4 41.8 18.8 41.4 17.6 42.2"/>
</g>
</g>
<path class="stem" data-stem d="M24 35.6"/>
<g data-leaves>
<g data-leaf-l>
<path class="leaf" fill="url(#foglia-s)" d="M0 0C-2.6-.6-6.6-.2-9.2 2.2-6.6 4.6-2.6 3.6 0 0Z"/>
<path class="leaf__rib" d="M0 0C-3 1-5.6 1.6-8 2.2"/>
</g>
<g data-leaf-r>
<path class="leaf" fill="url(#foglia-d)" d="M0 0C2.4-1.4 6.2-2.6 9.6-1.2 8-1.6 3.6 3.4 0 0Z"/>
<path class="leaf__rib" d="M0 0C3-.8 5.8-1.2 8.6-1.1"/>
</g>
<g data-bud><path class="bud" d="M0 0C-.8-1.2-.6-2.6.4-3.4 1.2-2.4 1-1 0 0Z"/></g>
</g>
<g data-seed>
<ellipse class="seed" cx="0" cy="0" rx="2.9" ry="2.1" fill="url(#seme)"/>
<path class="seed__line" d="M-1.8-.5C-.6-1.2.9-1.2 2-.4"/>
</g>
<g class="dust" data-dust>
<circle cx="24" cy="33" r=".55"/><circle cx="24" cy="33" r=".45"/><circle cx="24" cy="33" r=".5"/><circle cx="24" cy="33" r=".4"/><circle cx="24" cy="33" r=".45"/>
</g>
</g>
<circle class="pot__rim" cx="24" cy="24" r="23.4"/>
</svg>
</span>
<span class="plant__words">
<span class="plant__label" data-idle>Plant a tree</span>
<span class="plant__label plant__label--on" data-on aria-hidden="true">Tree planted</span>
</span>
<span class="plant__price" data-price aria-hidden="true">$1</span>
</button>
<div class="plot__count">
<p class="tally" aria-live="polite">
<span class="tally__num" data-num aria-label="12,480"></span>
<span class="tally__word">trees planted</span>
<span class="tally__plus" data-plus aria-hidden="true">+1</span>
</p>
<span class="goal" aria-hidden="true"><span class="goal__bar" data-bar></span></span>
<span class="tally__goal">Goal <span data-goal>15,000</span></span>
</div>
</div>
<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.
21 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 “Plant a tree button” from Animorio and fit it into my siteThe knob is a 48-unit SVG cut by a round clipPath: inside there is the soil with a vertical gradient from warm brown to near black, the wavy surface with a lighter thread and five pebbles. The roots sit in a second clipPath that starts under the surface, so they never show above the soil, and they draw themselves with stroke-dashoffset, each a little after the one before.
The stem is not a fixed path: it is an object of numbers (how far it has grown, how bent the hook is, how much it sways) and a draw() function that rewrites the d attribute on every update, with two Bézier curves: the stem and the hook on top. GSAP only animates those numbers; the hook opens as growth reaches the end with back.out, and that is where the plant feels alive.
The two leaves sit in a group that draw() carries to the stem’s tip with translate and rotate; each has its own scale and fold (58 degrees closed, zero open), written into the transform attribute. The scale arrives with back.out, the fold with elastic.out: they open a little too far and come back, like real leaves stretching out.
Each digit of the counter is a column from 0 to 9 inside a window one line tall; it moves with yPercent of minus ten times the digit. On a new tree only the columns that change roll, from the right, staggered by seven hundredths; if the number changes length the columns are rebuilt. The thousands comma is a separate element that does not roll.
Once the tree is planted a single GSAP ticker listener adds two sines of different frequencies into the sway: the stem’s tip moves and the leaves turn with it. The amplitude rises over eight tenths of a second, so the breeze never starts abruptly, and the ticker is removed when the sprout goes back in.
| Name | File | Default | What it changes |
|---|---|---|---|
GROW | script.js | 1.4 | How long the sprout takes to grow from the seed to its two leaves, in seconds. |
HOLD | script.js | 2.4 | How many seconds «Tree planted» stays before a new seed arrives. |
TREES | script.js | 12480 | The trees already planted, where the counter starts. |
GOAL | script.js | 15000 | The campaign goal, for the line under the counter. |
INK | script.js | #0e1a14 | The colour of the pill before planting. |
FOREST | script.js | #1d6b40 | The forest green that fills the pill once the tree is planted. |
For the main button of a climate app or site, a reforestation fundraiser, a shop that plants a tree with every order, or any action that makes something grow: the sprout tells you what happened and the counter tells you it matters.
On the phone the pill adapts to the width (at most 340 pixels, with a 16-pixel margin) and stays 60 tall; the sprout lives entirely in the knob, so nothing changes. There is no hover, everything else is the same.
The seed goes straight into the soil, the sprout with open leaves fades in without growing or swaying, the green spreads without a spring, the counter digits change without rolling and the drawn pointer is not shown.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.2 KB; the libraries: GSAP 28 KB.
Tested on 9 November 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.