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.8 KB
Raw Blame
function card(x,y,w,h,title,c='#ffffff'){saved(()=>{ctx.shadowColor='#0002';ctx.shadowBlur=18;rect(x,y,w,h,c,14)});text(title,x+20,y+27,18,c==='#ffffff'?'#222':'#fff','left','Arial',500,w-40)}
function chart(x,y,w,h,t,c=P.accent){line(x,y+h,x+w,y+h,'#999',1);for(let i=0;i<8;i++){let v=(.2+rand(i)*.6)*h*ease(t);rect(x+i*w/8,y+h-v,w/10,v,c,3)}}
function phone(x,y,w,h,t){rect(x,y,w,h,'#232323',27);rect(x+5,y+5,w-10,h-10,'#fcfcfa',23);rect(x+w*.38,y+12,w*.24,8,'#222',5);for(let i=0;i<3;i++){let yy=y+60+i*80-25*ease(t);card(x+16,yy,w-32,57,CONFIG.objects[i%CONFIG.objects.length],'#ffffff');rect(x+28,yy+40,(w-60)*ease(t+.2),3,P.accent,2)}}
function wires(x1,y1,x2,y2,c=P.accent){ctx.strokeStyle=c;ctx.lineWidth=2;ctx.beginPath();ctx.moveTo(x1,y1);ctx.bezierCurveTo((x1+x2)/2,y1,(x1+x2)/2,y2,x2,y2);ctx.stroke()}
function dots(x,y,n,c,t){for(let i=0;i<n;i++)ellipse(x+i*18,y,4,4,i/n<clamp(t)?c:'#cccccc')}
function drawScene(t){const u=stageProgress(t),n=stageAt(t),v=t/CONFIG.duration,b=CONFIG.palette[0],fg=CONFIG.palette[1];bg();fittedText(P.title,500,55,32,fg,900,'Arial',600);
rect(35,130,160,330,'#264e55',35);rect(820,350,145,155,'#3c4435',20);line(0,450,1000,410,'#ccbe9022',2);for(let i=-1;i<7;i++){let offset=160*sin(v*TAU),x=120+i*165-offset,r=[55,31,52,48,44,51,35,55][(i+8)%8];saved(()=>{ctx.beginPath();ctx.ellipse(x,300,r,r,0,0,TAU);ctx.clip();let g=ctx.createRadialGradient(x-r*.3,280,3,x,300,r);g.addColorStop(0,CONFIG.palette[2+(i+6)%3]);g.addColorStop(1,'#14282b');rect(x-r,300-r,2*r,2*r,g);for(let j=0;j<5;j++){at(x,300,1,.45,()=>{rect(-r*1.4,-r+j*r*.5+sin(t*.4+i)*12,r*2.8,r*.24,CONFIG.palette[2+(j+5)%3]+'88')})}});if(Math.abs(x-500)<70){text(['Venus','Jupiter','Saturn'][n%3],x,300,16,'#fff');text('LEARN →',x,324,10,'#fff')}};
text(CONFIG.stages[n].label,500,548,21,fg,'center','Arial',500,900);rect(50,581,900,3,fg+'22');rect(50,581,900*v,3,P.accent);}