(() => { const { Bodies } = Matter; const scenes = (window.PhysilinksSceneDefs = window.PhysilinksSceneDefs || []); scenes.push({ id: "swirl-arena", name: "Swirl Arena", config: { gravity: 0, gravityScale: 0.0007, timeScale: 0.9, spawnIntervalMs: 520, initialSpawnCount: 90, spawnLimit: 300, autoSpawn: true, minChain: 3, palette: ["#f472b6", "#22c55e"], ballRadius: 20, spawnOrigin: "center", spawnJitter: 120, blobBalls: false, noGameOver: true, winCondition: { type: "colorClear", targets: [{ color: "#22c55e", count: 100 }], onWin: { shoveBalls: true }, }, negativeScoreColors: ["#f472b6"], negativeProgressColors: ["#f472b6"], link: { stiffness: 0.82, lengthScale: 1.08, damping: 0.06, lineWidth: 3, rope: true, renderType: "line", maxLengthMultiplier: 3.6, }, onBeforeUpdate: ({ engine }) => { const t = (engine.timing?.timestamp || 0) * 0.0005; engine.gravity.x = Math.cos(t); engine.gravity.y = Math.sin(t); }, }, createBodies: (w, h) => { const wallThickness = Math.max(36, Math.min(w, h) * 0.05); const innerW = w - wallThickness * 2; const innerH = h - wallThickness * 2; const cx = w / 2; const cy = h / 2; const wallOptions = { isStatic: true, restitution: 0.3, render: { fillStyle: "#0b1222", strokeStyle: "#0b1222" }, }; return [ Bodies.rectangle( cx, cy - innerH / 2 - wallThickness / 2, innerW + wallThickness * 2, wallThickness, wallOptions, ), Bodies.rectangle( cx, cy + innerH / 2 + wallThickness / 2, innerW + wallThickness * 2, wallThickness, wallOptions, ), Bodies.rectangle( cx - innerW / 2 - wallThickness / 2, cy, wallThickness, innerH + wallThickness * 2, wallOptions, ), Bodies.rectangle( cx + innerW / 2 + wallThickness / 2, cy, wallThickness, innerH + wallThickness * 2, wallOptions, ), ]; }, }); })();