Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

1.1 KB
Raw Blame
const particleMasks=new Map();function targets(){if(particleMasks.has(P.title))return particleMasks.get(P.title);const c=document.createElement('canvas');c.width=1000;c.height=600;const q=c.getContext('2d');const rows=P.title.split('|').map(x=>x.trim());q.fillStyle='#fff';q.font='900 120px Arial';q.textAlign='center';q.textBaseline='middle';rows.forEach((s,i)=>q.fillText(s,500,300+(i-(rows.length-1)/2)*132,870));const d=q.getImageData(0,0,1000,600).data,pts=[];for(let y=0;y<600;y+=9)for(let x=0;x<1000;x+=9)if(d[(y*1000+x)*4+3]>100)pts.push([x,y]);particleMasks.set(P.title,pts);return pts;}
function drawScene(t){bg('#0c0d0e');targets().forEach(([x,y],i)=>{const enter=phase(t,.15+rand(i)*.7,1.3+rand(i)*.6);const leave=phase(t,4+rand(i)*.2,4.8+rand(i)*.45);const ox=rand(i+4)*1260-130,oy=rand(i+40)*900-150;const ex=rand(i+400)*1500-250,ey=rand(i+900)*1000-200;const px=mix(mix(ox,x,enter),ex,leave),py=mix(mix(oy,y,enter),ey,leave);alpha(1-leave*.85,()=>{if(i%3===0){line(px-3,py,px+3,py,P.accent,2);line(px,py-3,px,py+3,P.accent,2)}else if(i%3===1)ellipse(px,py,2.3,2.3,P.accent);else rect(px-2,py-2,4,4,P.accent)});});}