
Falling tools
Physics, Hover
An app’s profile photo editor, small and precise in the style of one-gesture micro-interactions: a real portrait drags under the round crop, past the edge a rubber band that grows stiffer holds it and on release a spring brings it back inside, flung it glides and stops with friction. Zoom has its own slider, the rule-of-thirds grid shows only while you hold the photo, and Save shrinks the circle into the avatar at the top.
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>
<!--
"Profile photo crop" 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 profile photo crop you drag into place</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 photo editor of a profile: drag the picture under the round frame, zoom with the slider,
the edges hold it on a rubber band and it settles back with a spring; Save shrinks it into the avatar -->
<section class="card" data-card aria-label="Edit profile photo">
<header class="card__head">
<button class="txt" type="button" data-reset>Reset</button>
<div class="head__mid">
<div class="mini" data-mini aria-hidden="true"><canvas data-mini-canvas></canvas></div>
<p class="head__title">
<span class="head__state" data-title-edit>Profile photo</span>
<span class="head__state head__state--done" data-title-done>Photo updated</span>
</p>
</div>
<button class="save" type="button" data-save>
<span class="save__label" data-save-label>Save</span>
<svg class="save__check" data-save-check viewBox="0 0 24 24" aria-hidden="true"><path d="M6 12.5 10.2 16.5 18 8" pathLength="1"></path></svg>
</button>
</header>
<div class="crop" data-crop>
<canvas class="crop__photo" data-photo aria-label="Photo, drag to move"></canvas>
<svg class="crop__mask" data-mask aria-hidden="true">
<defs>
<mask id="buco">
<rect width="100%" height="100%" fill="#fff"></rect>
<circle data-hole fill="#000"></circle>
</mask>
</defs>
<rect width="100%" height="100%" fill="rgba(12,12,14,0.58)" mask="url(#buco)"></rect>
<g class="crop__grid" data-grid>
<line data-g="v1"></line><line data-g="v2"></line><line data-g="h1"></line><line data-g="h2"></line>
</g>
<circle class="crop__ring" data-ring></circle>
</svg>
<p class="crop__hint" data-hint>Drag to reposition</p>
</div>
<div class="zoom">
<svg class="zoom__icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="10.5" cy="10.5" r="6"></circle><path d="M15 15l4.5 4.5M8 10.5h5"></path></svg>
<div class="zoom__track" data-track role="slider" tabindex="0" aria-label="Zoom" aria-valuemin="100" aria-valuemax="300" aria-valuenow="100">
<div class="zoom__fill" data-zfill></div>
<div class="zoom__knob" data-knob></div>
</div>
<svg class="zoom__icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="10.5" cy="10.5" r="6"></circle><path d="M15 15l4.5 4.5M8 10.5h5M10.5 8v5"></path></svg>
<span class="zoom__val" data-zval>1.0x</span>
</div>
</section>
<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.
20 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 “Profile photo crop” from Animorio and fit it into my siteThe photo is a real portrait cut square and drawn into the canvas, as big as the frame’s long side times the zoom. The circle stays covered as long as the offset is within (photo side minus circle diameter) divided by two, on each axis: that is the limit, and it grows with zoom.
While dragging, the part past the limit goes through a hyperbolic tangent: L times tanh(overshoot divided by L). Near the edge the photo follows almost one to one, then less and less, and never goes beyond L, a fraction of the circle set by RUBBER.
On release the speed is taken from the last 90 milliseconds of the gesture. On GSAP’s ticker, inside the limit the speed decays with friction, outside it a damped spring (stiffness 260 times SPRING, damping just under critical) brings it back to the edge without long bounces.
The veil is a rectangle with an SVG mask that has a round hole; the circle and the grid live in the same SVG. Save copies the circle’s square from the canvas into a 22 pixel canvas, which pops in next to the title as the title rolls over.
| Name | File | Default | What it changes |
|---|---|---|---|
MAX_ZOOM | script.js | 3 | How far the photo can be zoomed (1 = as it fits). |
RUBBER | script.js | 0.55 | How far it lets you pull past the edge before the rubber band stops it. |
SPRING | script.js | 1 | How stiff the spring that brings it back inside the circle is. |
FRICTION | script.js | 0.9 | How far it glides after a fling: higher goes further. |
RING | script.js | 1.5 | The thickness of the crop circle, in pixels. |
SHADE | script.js | 0.58 | How dark the outside of the circle is. |
ACCENT | script.js | #12a150 | The colour of the confirmation. |
HOLD | script.js | 1.8 | The seconds the confirmation stays before starting again. |
For the profile photo of an app, an account or a community, and anywhere you choose how to frame an image before uploading it: a podcast cover, a team logo, a product photo.
The card takes almost the whole width of the box and the photo frame is sized on the height too; with a finger the photo drags and flings as with the mouse, without scrolling the page.
No rubber band, spring or glide: the photo follows the finger and always stays within the limit; the autopilot only shows the states and the confirmation fades in.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.1 KB; the libraries: GSAP 28 KB.
Tested on 5 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.