| 29 | if (!ctx) return; |
| 30 | |
| 31 | const createVideoFrame = () => { |
| 32 | ctx.fillStyle = '#000000'; |
| 33 | ctx.fillRect(0, 0, canvas.width, canvas.height); |
| 34 | |
| 35 | const time = Date.now() / 1000; |
| 36 | |
| 37 | ctx.fillStyle = '#8A2BE2'; |
| 38 | ctx.beginPath(); |
| 39 | ctx.arc( |
| 40 | canvas.width / 2 + Math.cos(time) * 50, |
| 41 | canvas.height / 2 + Math.sin(time) * 50, |
| 42 | 20, |
| 43 | 0, |
| 44 | Math.PI * 2 |
| 45 | ); |
| 46 | ctx.fill(); |
| 47 | |
| 48 | ctx.strokeStyle = '#B388FF'; |
| 49 | ctx.lineWidth = 2; |
| 50 | for (let i = 0; i < 3; i++) { |
| 51 | const x = Math.sin(time * (i + 1)) * 100 + canvas.width / 2; |
| 52 | const y = Math.cos(time * (i + 1)) * 100 + canvas.height / 2; |
| 53 | ctx.strokeRect(x - 15, y - 15, 30, 30); |
| 54 | } |
| 55 | |
| 56 | ctx.fillStyle = '#ffffff'; |
| 57 | ctx.font = '12px monospace'; |
| 58 | ctx.fillText(label, 10, 20); |
| 59 | ctx.fillText(new Date().toLocaleTimeString(), 10, canvas.height - 10); |
| 60 | |
| 61 | ctx.fillStyle = '#ff0000'; |
| 62 | ctx.beginPath(); |
| 63 | ctx.arc(canvas.width - 20, 20, 5, 0, Math.PI * 2); |
| 64 | ctx.fill(); |
| 65 | |
| 66 | requestRef.current = requestAnimationFrame(createVideoFrame); |
| 67 | }; |
| 68 | |
| 69 | createVideoFrame(); |
| 70 | |