MCPcopy Create free account
hub / github.com/dashrobotco/robot-components / drawRoundedSquare

Function drawRoundedSquare

app/nodegrid/page.tsx:2460–2474  ·  view source on GitHub ↗
(ctx: CanvasRenderingContext2D, size: number, radius: number)

Source from the content-addressed store, hash-verified

2458
2459 // Draw rounded square
2460 const drawRoundedSquare = (ctx: CanvasRenderingContext2D, size: number, radius: number) => {
2461 const half = size * 0.7;
2462 const r = Math.min(radius, half);
2463 ctx.beginPath();
2464 ctx.moveTo(-half + r, -half);
2465 ctx.lineTo(half - r, -half);
2466 ctx.quadraticCurveTo(half, -half, half, -half + r);
2467 ctx.lineTo(half, half - r);
2468 ctx.quadraticCurveTo(half, half, half - r, half);
2469 ctx.lineTo(-half + r, half);
2470 ctx.quadraticCurveTo(-half, half, -half, half - r);
2471 ctx.lineTo(-half, -half + r);
2472 ctx.quadraticCurveTo(-half, -half, -half + r, -half);
2473 ctx.closePath();
2474 };
2475
2476 // Draw a single particle (blue - regular, fades)
2477 const drawParticle = (ctx: CanvasRenderingContext2D, p: Particle) => {

Callers 2

drawParticleFunction · 0.85
drawBouncyParticleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected