
Falling tools
Physics, Hover
A small picture-in-picture video window over a document page, in the clean style of today’s apps: you drag it with a finger and, let go, it flies with the momentum of the throw toward the nearest corner in the direction you threw it, snapping in on a short spring that bounces by a pixel. Pulled past a side it tucks into a tab, and a tap brings it back.
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>
<!--
"Corner-snapping video" 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 video window that snaps to the corners</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 document app with a picture-in-picture video: drag it, fling it and it flies to the nearest corner
in the direction of the throw, snapping on a short spring; pull it past a side and it tucks into a tab -->
<section class="app" data-app aria-label="Paperlane document with a floating video">
<header class="app__bar">
<div class="app__brand">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3.5h8.5L19 8v12.5H6Z"></path><path d="M14.5 3.5V8H19"></path></svg>
<span>Paperlane</span>
</div>
<p class="app__crumb">Launch plan <span class="app__sep">/</span> <b>Q4 roadmap review</b></p>
<div class="app__share">Share</div>
</header>
<div class="doc" data-doc>
<div class="doc__page">
<p class="doc__kicker">Notes · Oct 26</p>
<h1 class="doc__title">Q4 roadmap review</h1>
<div class="doc__lines">
<i style="width:92%"></i><i style="width:84%"></i><i style="width:88%"></i><i style="width:46%"></i>
<i class="gap" style="width:30%"></i>
<i style="width:90%"></i><i style="width:76%"></i><i style="width:86%"></i><i style="width:58%"></i>
<i class="gap" style="width:26%"></i>
<i style="width:88%"></i><i style="width:80%"></i><i style="width:40%"></i>
</div>
</div>
<!-- the four snap zones: they light up faintly while the window is held -->
<div class="zone" data-zone="0"></div><div class="zone" data-zone="1"></div>
<div class="zone" data-zone="2"></div><div class="zone" data-zone="3"></div>
<div class="pip" data-pip role="group" aria-label="Floating video, drag to move">
<div class="pip__body" data-body>
<canvas class="pip__video" data-video></canvas>
<div class="pip__top">
<span class="pip__live">Recording</span>
<span class="pip__name">Launch keynote</span>
</div>
<div class="pip__controls" data-controls>
<button type="button" class="pip__btn" aria-label="Pause"><svg viewBox="0 0 24 24"><path d="M9 6.5v11M15 6.5v11"></path></svg></button>
<button type="button" class="pip__btn" aria-label="Back to the tab"><svg viewBox="0 0 24 24"><path d="M14 5h5v5M19 5l-7 7M10 5H5v14h14v-5"></path></svg></button>
<button type="button" class="pip__btn" aria-label="Close"><svg viewBox="0 0 24 24"><path d="M7 7l10 10M17 7 7 17"></path></svg></button>
</div>
<div class="pip__foot">
<span class="pip__time" data-time>12:48</span>
<div class="pip__track"><div class="pip__fill" data-fill></div></div>
<span class="pip__time pip__time--end">41:02</span>
</div>
</div>
<!-- the tab shown when the window is tucked away at a side -->
<button type="button" class="pip__tab" data-tab aria-label="Bring the video back">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M14.5 6.5 9 12l5.5 5.5"></path></svg>
</button>
</div>
</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.
26 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 “Corner-snapping video” from Animorio and fit it into my siteWhile dragging, the window keeps the last 90 milliseconds of positions and derives its speed from them. On release the landing point is projected forward, position plus velocity times THROW seconds, and the corner is the quadrant the projected centre falls in: a flick upward takes it to the top even if you let go low on the page.
The flight to the corner is not a tween but a spring integrated every frame in GSAP’s ticker, split into 8 millisecond steps: the acceleration is minus the stiffness times the distance, minus the damping times the speed. The window starts with the real speed of the throw, and with a damping of 0.8 it goes a pixel past the corner and comes back.
The four zones are dashed rectangles, with the accent colour mixed in the script rather than with color-mix in the CSS, because the preview recorder doesn’t draw it. While the window is held, every move recomputes the landing corner and its zone rises to full opacity while the others stay at 40%.
If the projected centre leaves the page, the spring carries the window just past the side and a tab, a child of the window, stays inside the page with an arrow pointing the way back. A tap returns it to the corner on that side closest to the height where it was tucked.
The recording is a canvas redrawn every frame by the same ticker: three radial gradients added in lighter mode moving on slow sines, a pale slide and a grain pattern shifted slowly. The bar and the clock move on with GSAP’s clock.
| Name | File | Default | What it changes |
|---|---|---|---|
SIZE | script.js | 0.34 | How wide the video window is compared to the page. |
STIFFNESS | script.js | 380 | The stiffness of the spring that snaps it to the corner: higher is quicker. |
DAMPING | script.js | 0.8 | The spring’s damping: 1 with no bounce, lower bounces more. |
THROW | script.js | 0.2 | How much the throw counts: the seconds of flight used to pick the corner. |
MARGIN | script.js | 14 | The gap between the window and the edge of the page, in pixels. |
ACCENT | script.js | #4f46e5 | The colour of the snap zones. |
HOLD | script.js | 1.4 | The seconds of pause between one throw and the next of the drawn pointer. |
For an app with calls or videos that stay open while you work: a lesson, a meeting, a live stream or a tutorial that follows someone writing a document, without covering their text.
The same physics with a finger: the app window is sized on the width and the height of the box, the video window stays at least 140 pixels wide and the corners are recomputed on every resize.
No flight and no spring: let go, the window fades out and reappears in the chosen corner; there is no drawn pointer and the window moves from corner to corner with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.3 KB; the libraries: GSAP 28 KB.
Tested on 26 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.