This represents the monarch butterfly migration. The flower is milkweed, where the butterflies lay their eggs.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World — a monarch migration</title>
<style>
:root{
--ink:#171310;
}
*{box-sizing:border-box;}
html,body{
margin:0; padding:0; height:100%; width:100%;
overflow:hidden;
background:
radial-gradient(ellipse 60% 40% at 50% 8%, rgba(255,244,214,.9), rgba(255,244,214,0) 60%),
linear-gradient(180deg,
#fdf3e2 0%,
#ffe2ab 26%,
#f6c98c 44%,
#e0b884 52%,
#cfe3a3 63%,
#aed17f 82%,
#8ebd63 100%);
font-family: Georgia, 'Times New Roman', serif;
}
.sr-only{
position:absolute; width:1px; height:1px; padding:0; margin:-1px;
overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
#scene{ position:relative; width:100%; height:100%; }
/* distant hill silhouette for depth */
#hills{ position:absolute; left:0; right:0; bottom:0; width:100%; height:26%; }
#flowers, #butterflies, #caption-layer{
position:absolute; inset:0; pointer-events:none;
}
#flowers{ z-index:2; }
#butterflies{ z-index:3; }
#caption-layer{ z-index:4; display:flex; align-items:flex-end; justify-content:center; }
/* ---------- milkweed ---------- */
.milkweed{
position:absolute;
transform: translate(-50%,-62%);
transform-origin: 50% 92%;
animation: sway var(--sway-dur,4s) ease-in-out infinite;
animation-delay: var(--sway-delay,0s);
opacity:.96;
}
@keyframes sway{
0%,100%{ transform: translate(-50%,-62%) rotate(-2.2deg); }
50%{ transform: translate(-50%,-62%) rotate(2.2deg); }
}
.milkweed .leaf{ fill:#5f8f4d; }
.milkweed .leaf.dark{ fill:#4d7a3e; }
.milkweed .stem{ stroke:#4a7a3c; stroke-width:1.6; stroke-linecap:round; }
.milkweed .bloom circle{ fill:#d98bb0; }
.milkweed .bloom circle.hi{ fill:#f1c3da; }
/* ---------- butterflies ---------- */
.butterfly{
position:absolute; left:0; top:0; width:0; height:0;
offset-rotate: auto;
offset-distance: 0%;
transition:
offset-distance var(--dur,6s) cubic-bezier(.42,.04,.53,.98) var(--delay,0s),
offset-rotate 1.4s ease-out var(--delay,0s);
}
.butterfly.landed{ offset-rotate: 0deg; }
.bfly-inner{
position:absolute; left:-16px; top:-18px; width:32px; height:36px;
filter: var(--tint, none);
}
.bfly-svg{ position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.wings{ animation: flap .22s infinite alternate ease-in-out; transform-origin: 0px 2px; }
.landed .wings{ animation-duration: 1.7s; animation-timing-function: ease-in-out; }
@keyframes flap{ from{ transform:scaleX(1); } to{ transform:scaleX(.42); } }
.fw{ fill:var(--wing1,#e8720c); stroke:var(--ink); stroke-width:.6; }
.hw{ fill:var(--wing2,#d9660c); stroke:var(--ink); stroke-width:.6; }
.vein{ fill:none; stroke:var(--ink); stroke-width:.45; opacity:.55; }
.spot{ fill:#fdf3df; }
.bfbody{ fill:var(--ink); }
.antenna{ fill:none; stroke:var(--ink); stroke-width:.6; stroke-linecap:round; }
.egg{
position:absolute; width:4px; height:4px; border-radius:50%;
left:16px; top:24px;
background:#f7f0c4;
box-shadow:0 0 2px rgba(0,0,0,.35);
opacity:0; transform:scale(0);
transition: opacity .7s ease .3s, transform .7s cubic-bezier(.3,1.6,.4,1) .3s;
}
.landed .egg{ opacity:1; transform:scale(1); }
#caption{
font-style:italic; letter-spacing:.06em; font-size:15px; color:#463522;
opacity:0; transform:translateY(6px);
transition:opacity 1.6s ease, transform 1.6s ease;
margin-bottom:4vh; text-shadow:0 1px 0 rgba(255,255,255,.4);
}
#caption.show{ opacity:.75; transform:translateY(0); }
</style>
</head>
<body>
<h1 class="sr-only">Hello World</h1>
<div id="scene">
<svg id="hills" viewBox="0 0 1000 200" preserveAspectRatio="none">
<path d="M0,120 C150,70 300,150 480,110 C650,75 780,140 1000,95 L1000,200 L0,200 Z" fill="#7fae5c" opacity="0.55"/>
<path d="M0,160 C200,120 380,175 600,140 C780,112 880,170 1000,150 L1000,200 L0,200 Z" fill="#6c9c4c" opacity="0.7"/>
</svg>
<div id="flowers"></div>
<div id="butterflies"></div>
<div id="caption-layer"><div id="caption">hello world — as the monarchs land</div></div>
</div>
<script>
(function(){
// ---------- 1. Sample the words "HELLO WORLD" into a point cloud ----------
var CW = 1000, CH = 230;
var canvas = document.createElement('canvas');
canvas.width = CW; canvas.height = CH;
var ctx = canvas.getContext('2d');
ctx.textBaseline = 'middle';
ctx.textAlign = 'center';
var text = 'HELLO WORLD';
var fontSize = 230;
ctx.font = '900 ' + fontSize + 'px Arial, "Helvetica Neue", sans-serif';
while (ctx.measureText(text).width > CW * 0.94 && fontSize > 10) {
fontSize -= 2;
ctx.font = '900 ' + fontSize + 'px Arial, "Helvetica Neue", sans-serif';
}
ctx.fillStyle = '#fff';
ctx.fillText(text, CW / 2, CH / 2);
var img = ctx.getImageData(0, 0, CW, CH).data;
function alphaAt(x, y){
x = Math.max(0, Math.min(CW - 1, Math.round(x)));
y = Math.max(0, Math.min(CH - 1, Math.round(y)));
return img[(y * CW + x) * 4 + 3];
}
function samplePoints(step, jitter, cap){
var pts = [];
for (var y = step / 2; y < CH; y += step){
for (var x = step / 2; x < CW; x += step){
if (alphaAt(x, y) > 140){
pts.push({
x: x + (Math.random() - 0.5) * jitter,
y: y + (Math.random() - 0.5) * jitter
});
}
}
}
if (pts.length > cap){
// thin randomly down to cap
pts.sort(function(){ return Math.random() - 0.5; });
pts = pts.slice(0, cap);
}
return pts;
}
var butterflyPoints = samplePoints(9, 5, 420); // dense — the migrating swarm
var flowerPoints = samplePoints(24, 8, 130); // sparser — the milkweed bed
// ---------- 2. Map canvas space to viewport space ----------
var vw = window.innerWidth, vh = window.innerHeight;
var scale = (vw * 0.86) / CW;
var dispW = CW * scale, dispH = CH * scale;
var offX = (vw - dispW) / 2;
var offY = vh * 0.5 - dispH / 2 - vh * 0.02;
function toScreen(p){
return { x: offX + p.x * scale, y: offY + p.y * scale };
}
// ---------- 3. Plant the milkweed ----------
var flowersLayer = document.getElementById('flowers');
var milkweedTemplate =
'<svg class="bfly-svg" viewBox="-12 -12 24 42">' +
'<path class="leaf" d="M0,7 C -9,5 -13,11 -15,17 C -10,19 -3,17 0,11 Z"/>' +
'<path class="leaf dark" d="M0,11 C 9,9 13,15 15,21 C 10,23 3,21 0,15 Z"/>' +
'<line class="stem" x1="0" y1="-6" x2="0" y2="26"/>' +
'<g class="bloom">' +
'<circle cx="0" cy="-8" r="2.6"/>' +
'<circle cx="-3.2" cy="-5" r="2.3"/>' +
'<circle cx="3.2" cy="-5" r="2.3"/>' +
'<circle cx="-2" cy="-1.5" r="2.1"/>' +
'<circle cx="2" cy="-1.5" r="2.1"/>' +
'<circle class="hi" cx="0" cy="-4.5" r="1.6"/>' +
'</g>' +
'</svg>';
flowerPoints.forEach(function(p){
var s = toScreen(p);
var el = document.createElement('div');
el.className = 'milkweed';
var size = 30 + Math.random() * 14;
el.style.left = s.x + 'px';
el.style.top = s.y + 'px';
el.style.width = size + 'px';
el.style.height = (size * 1.7) + 'px';
el.style.setProperty('--sway-dur', (3 + Math.random() * 2.5).toFixed(2) + 's');
el.style.setProperty('--sway-delay', (Math.random() * 3).toFixed(2) + 's');
el.innerHTML = milkweedTemplate;
flowersLayer.appendChild(el);
});
// ---------- 4. Release the monarchs ----------
var butterfliesLayer = document.getElementById('butterflies');
var wingMarkup =
'<g class="wing-left">' +
'<path class="fw" d="M -1,-2 C -6,-14 -17,-19 -22,-13 C -25,-8 -24,2 -16,6 C -9,10 -3,4 -1,-2 Z"/>' +
'<path class="hw" d="M -1,2 C -5,10 -14,17 -18,23 C -20,27 -16,30 -10,28 C -4,25 1,15 2,6 Z"/>' +
'<path class="vein" d="M -1,-2 L -14,-4 M -1,-2 L -10,4 M -1,2 L -8,10 M -1,2 L -4,18"/>' +
'<circle class="spot" cx="-16" cy="-9" r="1.3"/>' +
'<circle class="spot" cx="-19" cy="-3" r="1.1"/>' +
'<circle class="spot" cx="-13" cy="20" r="1.1"/>' +
'<circle class="spot" cx="-8" cy="24" r="1"/>' +
'</g>' +
'<g class="wing-right" transform="scale(-1,1)">' +
'<path class="fw" d="M -1,-2 C -6,-14 -17,-19 -22,-13 C -25,-8 -24,2 -16,6 C -9,10 -3,4 -1,-2 Z"/>' +
'<path class="hw" d="M -1,2 C -5,10 -14,17 -18,23 C -20,27 -16,30 -10,28 C -4,25 1,15 2,6 Z"/>' +
'<path class="vein" d="M -1,-2 L -14,-4 M -1,-2 L -10,4 M -1,2 L -8,10 M -1,2 L -4,18"/>' +
'<circle class="spot" cx="-16" cy="-9" r="1.3"/>' +
'<circle class="spot" cx="-19" cy="-3" r="1.1"/>' +
'<circle class="spot" cx="-13" cy="20" r="1.1"/>' +
'<circle class="spot" cx="-8" cy="24" r="1"/>' +
'</g>';
var butterflyTemplate =
'<div class="bfly-inner">' +
'<svg class="bfly-svg" viewBox="-20 -22 40 46">' +
'<g class="wings">' + wingMarkup + '</g>' +
'<ellipse class="bfbody" cx="0" cy="2" rx="1.6" ry="11"/>' +
'<path class="antenna" d="M -0.6,-9 C -2,-14 -4,-16 -5,-19 M 0.6,-9 C 2,-14 4,-16 5,-19"/>' +
'</svg>' +
'<div class="egg"></div>' +
'</div>';
var landedCount = 0;
var total = butterflyPoints.length;
var maxFinish = 0;
butterflyPoints.forEach(function(p, i){
var end = toScreen(p);
// choose an off-screen start, weighted toward "above"
var side = Math.random();
var sx, sy;
if (side < 0.55){
sx = Math.random() * vw;
sy = -60 - Math.random() * 200;
} else if (side < 0.78){
sx = -60 - Math.random() * 150;
sy = Math.random() * vh * 0.7;
} else {
sx = vw + 60 + Math.random() * 150;
sy = Math.random() * vh * 0.7;
}
var mx = (sx + end.x) / 2 + (Math.random() - 0.5) * 220;
var my = (sy + end.y) / 2 + (Math.random() - 0.5) * 160;
var pathStr = 'M ' + sx.toFixed(1) + ' ' + sy.toFixed(1) +
' Q ' + mx.toFixed(1) + ' ' + my.toFixed(1) +
' ' + end.x.toFixed(1) + ' ' + end.y.toFixed(1);
var el = document.createElement('div');
el.className = 'butterfly';
el.style.offsetPath = "path('" + pathStr + "')";
var dur = 5 + Math.random() * 4.5;
var delay = Math.random() * 4.5;
el.style.setProperty('--dur', dur.toFixed(2) + 's');
el.style.setProperty('--delay', delay.toFixed(2) + 's');
maxFinish = Math.max(maxFinish, dur + delay);
// organic color variance per butterfly
var hue = 24 + Math.random() * 12;
var wing1 = 'hsl(' + hue.toFixed(0) + ',82%,' + (46 + Math.random() * 8).toFixed(0) + '%)';
var wing2 = 'hsl(' + (hue - 4).toFixed(0) + ',80%,' + (40 + Math.random() * 8).toFixed(0) + '%)';
el.style.setProperty('--wing1', wing1);
el.style.setProperty('--wing2', wing2);
var scaleV = 0.8 + Math.random() * 0.55;
el.innerHTML = butterflyTemplate;
el.querySelector('.bfly-inner').style.transform = 'scale(' + scaleV.toFixed(2) + ')';
el.addEventListener('transitionend', function(e){
if (e.propertyName === 'offset-distance' && !el.classList.contains('landed')){
el.classList.add('landed');
landedCount++;
if (landedCount === total){
setTimeout(function(){
document.getElementById('caption').classList.add('show');
}, 500);
}
}
});
butterfliesLayer.appendChild(el);
});
// trigger the migration on the next frame so the transition actually runs
requestAnimationFrame(function(){
requestAnimationFrame(function(){
document.querySelectorAll('.butterfly').forEach(function(el){
el.style.offsetDistance = '100%';
});
});
});
})();
</script>
</body>
</html>
Nothing. This page is entirely self-contained and contacts no other website when it runs.
Published on Globefin under the MIT License. You may copy, change, and reuse this page, including commercially — just keep the notice below with it.
Copyright © 2026 Jessica Reynolds. Licensed under the MIT License. Published on Globefin.
Provided as is, without warranty. Any external libraries it loads keep their own licences. Terms →
Scripts run, but the demo has its own throwaway origin. It can't read your session or cookies, can't reach the page around it, and can't navigate your tab. Don't enter real passwords or personal data into any demo.