← back to Model Arena
data/artifacts/0ac1af2eaed4/qwen3-14b.html
13 lines
<!DOCTYPE html>
<html>
<head>
<style>canvas{display:block;background:#000;}</style>
</head>
<body>
<canvas></canvas>
<script>
const canvas=document.querySelector("canvas"),ctx=canvas.getContext("2d"),rockets=[],particles=[],gravity=0.5;
function addRocket(x,y){rockets.push({x,y,vx:0,vy:-5,exploded:false,trail:[]});}
function explodeRocket(r){for(let i=0;i<50;i++){const a=Math.random()*Math.PI*2,s=Math.random()*5+3;particles.push({x:r.x,y:r.y,vx:Math.cos(a)*s,vy:Math.sin(a)*s-2,life:100,color:`hsl(${Math.random()*360},100%,70%)`,trail:[{x:r.x,y:r.y}]})}r.exploded=true;}
function update(){for(let i=rockets.length-1;i>=0;i--){let r=rockets[i];if(!r.exploded){r.vy+=gravity;r.x+=r.vx;r.y+=r.vy;r.trail.push({x:r.x,y:r.y});if(r.trail.length>10)r.trail.shift();if(r.y<0)explodeRocket(r)}}for(let i=particles.length-1;i>=0;i--){let p=particles[i];p.vy+=gravity;p.x+=p.vx;p.y+=p.vy;p.life--;p.trail.push({x:p.x,y:p.y});if(p.trail.length>10)p.trail.shift();if(p.life<=0)particles.splice(i,1);}}
function draw(){ctx.fillStyle="rgba(0,0,0,0.2)";ctx.fillRect(0,0,canvas.width,canvas.height);for(let r of rockets){if(!r.exploded){ctx.beginPath();ctx.arc(r.x,r.y,4,0,Math.PI*2);ctx.fillStyle="white";ctx.fill();ctx.beginPath();for(let j=0;j<r.trail.length;j++){let p=r.trail[j];ctx.moveTo(p.x,p.y);ctx