Show code
<!doctype html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Wire Solids</title><style>html,body{margin:0;height:100%;overflow:hidden;background:#090b10;color:#d8e6ff;font:14px system-ui}canvas{display:block;width:100%;height:100%}</style></head><body><canvas id=c></canvas><script>
const c=document.getElementById("c"),x=c.getContext("2d"),C=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1],[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]],CE=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[1,5],[2,6],[3,7]],T=[[0,1.25,0],[-1,-.7,-1],[1,-.7,-1],[0,-.7,1.15]],TE=[[0,1],[0,2],[0,3],[1,2],[2,3],[3,1]];
let W,H,D,objs=[],start=0,life=18000;
function rs(){let d=devicePixelRatio||1;W=c.width=innerWidth*d;H=c.height=innerHeight*d;x.setTransform(d,0,0,d,0,0);W=innerWidth;H=innerHeight}
onresize=rs;rs();
function rnd(a,b){return a+Math.random()*(b-a)}
function make(t=performance.now()){start=t;objs=[];for(let i=0;i<7;i++){let cube=Math.random()<.55,s=rnd(.45,.9),z=rnd(2.5,7.5);objs.push({v:(cube?C:T).map(p=>[p[0]*s,p[1]*s,p[2]*s]),e:cube?CE:TE,p:[rnd(-2.4,2.4),rnd(-1.4,1.4),z],r:[rnd(0,6.28),rnd(0,6.28)],w:[rnd(.35,.9)*(Math.random()<.5?-1:1),rnd(.3,.8)*(Math.random()<.5?-1:1)],h:rnd(185,220)})}}
function rot(p,a,b){let sx=Math.sin(a),cx=Math.cos(a),sy=Math.sin(b),cy=Math.cos(b),y=p[1]*cx-p[2]*sx,z=p[1]*sx+p[2]*cx,x0=p[0]*cy+z*sy;return[x0,y,-p[0]*sy+z*cy]}
function proj(p){let f=Math.min(W,H)*.78,q=f/(f*.012+p[2]);return[W/2+p[0]*q,H/2+p[1]*q,q]}
function frame(t){if(!start||t-start>life)make(t);x.fillStyle="#090b10";x.fillRect(0,0,W,H);let lines=[],n=0,tt=(t-start)/1000;for(const o of objs){let pts=o.v.map(p=>{let r=rot(p,o.r[0]+tt*o.w[0],o.r[1]+tt*o.w[1]);r[0]+=o.p[0]+Math.sin(tt*.35+o.p[2])*.25;r[1]+=o.p[1]+Math.cos(tt*.28+o.p[0])*.18;r[2]+=o.p[2];return{p:proj(r),z:r[2]}});let oz=pts.reduce((a,b)=>a+b.z,0)/pts.length;for(const e of o.e){let a=pts[e[0]],b=pts[e[1]],z=(a.z+b.z)/2;lines.push({a:a.p,b:b.p,z,oz,h:o.h});n++}}lines.sort((a,b)=>b.oz-a.oz||b.z-a.z);x.lineCap="round";for(const l of lines){let al=Math.max(.12,1-l.z/10);x.strokeStyle=`hsla(${l.h},90%,72%,${al})`;x.lineWidth=Math.max(.6,2.4-l.z*.18);x.beginPath();x.moveTo(l.a[0],l.a[1]);x.lineTo(l.b[0],l.b[1]);x.stroke()}x.fillStyle="#d8e6ff";x.fillText("edges drawn: "+n,16,24);requestAnimationFrame(frame)}
make();requestAnimationFrame(frame);
</script></body></html>