Parametric Gyroscopic Aperture.
A 20-ring mathematical aperture that projects real-time depth perspective and gyroscopic parallax coordinates across three dimensions without WebGL overhead.
View code
<div class="aperture-field" aria-hidden="true">
<svg viewBox="-250 -215 500 430" fill="none">
<circle class="aperture-orbit" r="174"/>
<circle class="aperture-orbit dotted" r="192"/>
<path class="aperture-axis" d="M-230 0H230M0-207V207"/>
<g class="aperture-rings"></g>
<circle class="aperture-core" r="5"/>
</svg>
<span class="aperture-coordinate">X 00.00 / Y 00.00</span>
</div>:root { color-scheme: dark; font: 15px system-ui, sans-serif; color: #dbff55; }
* { box-sizing: border-box; }
body { margin: 0; height: 100dvh; display: grid; place-items: center; overflow: hidden; background: transparent; }
.tile { display: grid; place-items: center; width: 68px; aspect-ratio: 1; border-radius: 18px; background: currentColor; }
.tile { background: #dbff55; color: #202415; font-size: 30px; }
canvas { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; }
button { font: inherit; color: #f3f1e9; background: #191919; border: 1px solid #ffffff66; padding: 8px 14px; border-radius: 24px; cursor: pointer; }
:focus-visible { outline: 2px solid #dbff55; outline-offset: -3px; }
.notice { max-width: 34ch; padding: 16px; color: #fff; }
@media (prefers-reduced-motion: reduce) { .sprite { animation-play-state: paused; } }
.aperture-field { width:100%; height:100%; display:grid; place-items:center; position:relative; overflow:hidden; color:#dbff55; }
.aperture-field svg { width:100%; height:100%; max-width:670px; max-height:620px; overflow:visible; }
.aperture-orbit,.aperture-axis { stroke:currentColor; opacity:.25; }
.aperture-orbit.dotted { stroke-dasharray:1 6; }
.aperture-rings path { stroke:currentColor; stroke-width:1.25; stroke-linejoin:round; }
.aperture-core { fill:currentColor; }
.aperture-coordinate { position:absolute; bottom:12px; left:12px; font:10px Consolas,monospace; letter-spacing:.12em; opacity:.75; }function mountAperture(field) {
const group = field.querySelector('.aperture-rings');
const readout = field.querySelector('.aperture-coordinate');
const rings = Array.from({length:20},(_,index)=>{
const ring = document.createElementNS('http://www.w3.org/2000/svg','path');
ring.setAttribute('opacity',.24+.7*index/19);
group.append(ring);
return ring;
});
const reduced = matchMedia('(prefers-reduced-motion: reduce)');
const pointer = {x:0,y:0};
const tilt = {x:0,y:0};
let frame, previous, time=0;
const draw = () => {
const a = tilt.x*.5 + time*.3;
const b = tilt.y*.5 + .43;
const scroll = Math.min(window.scrollY/850,1);
rings.forEach((ring,index)=>{
const depth = index/19;
const radius = 62+depth*92;
const points = Array.from({length:60},(_,step)=>{
const angle = step/60*Math.PI*2;
const phase = time*1.4-depth*5+scroll*2.5;
const wave = Math.sin(angle*5+phase)*(8+depth*13);
const x = (radius+wave)*Math.cos(angle+depth*.58);
const y = (radius+wave)*Math.sin(angle+depth*.58);
const z = (depth-.5)*107 + 20*Math.cos(angle*3+phase);
const spunX = x*Math.cos(a)-z*Math.sin(a);
const spunZ = z*Math.cos(a)+x*Math.sin(a);
const viewY = y*Math.cos(b)-spunZ*Math.sin(b);
const scale = 430/(430-(spunZ*Math.cos(b)+y*Math.sin(b)));
return (spunX*scale).toFixed(1)+' '+(viewY*scale).toFixed(1);
});
ring.setAttribute('d','M'+points.join(' L')+' Z');
});
readout.textContent = 'X '+tilt.x.toFixed(2)+' / Y '+tilt.y.toFixed(2);
};
function tick(now) {
if (previous !== undefined) time += Math.min(.05,(now-previous)/1000);
previous = now;
tilt.x += (pointer.x-tilt.x)*.07;
tilt.y += (pointer.y-tilt.y)*.07;
draw();
frame = requestAnimationFrame(tick);
}
function play(active) {
if (active && !frame && !reduced.matches) frame=requestAnimationFrame(tick);
if (!active || reduced.matches) {
cancelAnimationFrame(frame);
frame=undefined;
previous=undefined;
}
}
field.addEventListener('pointermove',event=>{
const bounds=field.getBoundingClientRect();
pointer.x=(event.clientX-bounds.left)/bounds.width*2-1;
pointer.y=(event.clientY-bounds.top)/bounds.height*2-1;
});
field.addEventListener('pointerleave',()=>{pointer.x=0;pointer.y=0;});
draw();
const embedded = new URLSearchParams(location.search).has('embed');
if (embedded) {
addEventListener('message',event=>{
if (event.source===parent && event.origin===location.origin && event.data?.type==='motion-play') play(event.data.active);
});
} else {
let visible=false;
const refresh=()=>play(visible && !document.hidden);
new IntersectionObserver(([entry])=>{visible=entry.isIntersecting;refresh();}).observe(field);
document.addEventListener('visibilitychange',refresh);
reduced.addEventListener('change',refresh);
}
}
mountAperture(document.querySelector(".aperture-field"));