MCPcopy Create free account
hub / github.com/Roy3838/Observer / draw

Method draw

app/src/utils/tauriStreamCapture.ts:196–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194 const ctx = canvas.getContext('2d')!;
195 let frame = 0;
196 const draw = () => {
197 frame++;
198 ctx.clearRect(0, 0, W, H);
199 const ACCENT = '#6366f1';
200 const BG = '#eef2ff';
201 ctx.fillStyle = BG;
202 ctx.fillRect(0, 0, W, H);
203 const cx = W / 2, cy = H / 2 - 10;
204 for (let i = 0; i < 2; i++) {
205 const phase = (frame / 100 + i * 0.5) % 1;
206 const radius = 70 + phase * 90;
207 const alpha = (1 - phase) * 0.12;
208 ctx.beginPath();
209 ctx.arc(cx, cy, radius, 0, Math.PI * 2);
210 ctx.strokeStyle = `rgba(99, 102, 241, ${alpha})`;
211 ctx.lineWidth = 1.5;
212 ctx.stroke();
213 }
214 ctx.fillStyle = ACCENT;
215 ctx.beginPath();
216 ctx.arc(cx, cy - 38, 28, 0, Math.PI * 2);
217 ctx.fill();
218 const bw = 52, bh = 62, bx = cx - bw / 2, by = cy - 6, r = 14;
219 ctx.beginPath();
220 ctx.moveTo(bx + r, by);
221 ctx.lineTo(bx + bw - r, by);
222 ctx.quadraticCurveTo(bx + bw, by, bx + bw, by + r);
223 ctx.lineTo(bx + bw, by + bh - r);
224 ctx.quadraticCurveTo(bx + bw, by + bh, bx + bw - r, by + bh);
225 ctx.lineTo(bx + r, by + bh);
226 ctx.quadraticCurveTo(bx, by + bh, bx, by + bh - r);
227 ctx.lineTo(bx, by + r);
228 ctx.quadraticCurveTo(bx, by, bx + r, by);
229 ctx.fill();
230 ctx.fillStyle = ACCENT;
231 ctx.font = 'italic 600 13px -apple-system, BlinkMacSystemFont, sans-serif';
232 ctx.textAlign = 'center';
233 ctx.textBaseline = 'middle';
234 ctx.fillText('a person', cx, cy - 105);
235 ctx.strokeStyle = ACCENT;
236 ctx.lineWidth = 1.5;
237 ctx.beginPath();
238 ctx.moveTo(cx, cy - 95);
239 ctx.lineTo(cx, cy - 78);
240 ctx.stroke();
241 ctx.fillStyle = ACCENT;
242 ctx.beginPath();
243 ctx.moveTo(cx, cy - 70);
244 ctx.lineTo(cx - 5, cy - 79);
245 ctx.lineTo(cx + 5, cy - 79);
246 ctx.closePath();
247 ctx.fill();
248 ctx.fillStyle = `rgba(99, 102, 241, 0.45)`;
249 ctx.font = '500 13px -apple-system, BlinkMacSystemFont, sans-serif';
250 ctx.fillText('No camera access', cx, H / 2 + 115);
251 requestAnimationFrame(draw);
252 };
253 requestAnimationFrame(draw);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected