Skip to content

Commit 4cfc6cf

Browse files
yoannmoinetclaude
andcommitted
feat(docs): asteroid tilt fix, dual-stick icons, observatory joystick border
Asteroid Dodge: - Pre-clear canvas before tilt to hide edge artifacts - Overdraw background by 40px padding for corner coverage - More visible motion lines (0.25 opacity, 1.5px width) Dual-Stick Arena: - Move icon (4-way arrows) on left joystick thumb - Shoot icon (crosshair) on right joystick thumb - Uses SVG files layered over gradient backgrounds Space Observatory: - Joystick back ring more visible with harder-edge radial gradient that creates a visible border at 93% radius Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 06a72b3 commit 4cfc6cf

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed
Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 8 additions & 0 deletions
Loading

packages/docs/src/games/asteroid-dodge.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,21 @@ export const createGame: CreateGame = (_container) => {
172172
}
173173

174174
function drawBackground() {
175+
// Overdraw background to cover corners exposed by canvas tilt
176+
const pad = 40;
175177
ctx.fillStyle = BG_COLOR;
176-
ctx.fillRect(0, 0, canvas.width, canvas.height);
178+
ctx.fillRect(-pad, -pad, canvas.width + pad * 2, canvas.height + pad * 2);
177179

178-
// Draw subtle vertical motion lines
180+
// Draw vertical motion lines
179181
ctx.save();
180182
for (const line of bgLines) {
181183
line.y += line.speed;
182184
if (line.y > canvas.height) {
183185
line.y = -line.length;
184186
line.x = Math.random() * canvas.width;
185187
}
186-
ctx.strokeStyle = 'rgba(56, 189, 248, 0.15)';
187-
ctx.lineWidth = 1;
188+
ctx.strokeStyle = 'rgba(56, 189, 248, 0.25)';
189+
ctx.lineWidth = 1.5;
188190
ctx.beginPath();
189191
ctx.moveTo(line.x, line.y);
190192
ctx.lineTo(line.x, line.y + line.length);
@@ -382,6 +384,10 @@ export const createGame: CreateGame = (_container) => {
382384
const tiltTarget = vectorX * -0.03;
383385
tilt += (tiltTarget - tilt) * 0.1;
384386

387+
// Clear canvas before tilt so edges are clean
388+
ctx.fillStyle = BG_COLOR;
389+
ctx.fillRect(0, 0, canvas.width, canvas.height);
390+
385391
ctx.save();
386392
if (shakeTime > 0) {
387393
const intensity = shakeTime / 12;

packages/docs/src/games/dual-stick-arena.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const createGame: CreateGame = (_container) => {
4242
mode: 'static',
4343
position: { left: '100px', bottom: '100px' },
4444
color: {
45-
front: 'linear-gradient(135deg, #818cf8, #38bdf8)',
45+
front: 'url("/nipplejs/assets/move.svg") center/60% no-repeat, linear-gradient(135deg, #818cf8, #38bdf8)',
4646
back: 'rgba(99,102,241,0.12)',
4747
},
4848
},
@@ -53,7 +53,7 @@ export const createGame: CreateGame = (_container) => {
5353
mode: 'static',
5454
position: { right: '100px', bottom: '100px' },
5555
color: {
56-
front: 'linear-gradient(135deg, #e879f9, #ec4899)',
56+
front: 'url("/nipplejs/assets/shoot.svg") center/60% no-repeat, linear-gradient(135deg, #e879f9, #ec4899)',
5757
back: 'rgba(236,72,153,0.12)',
5858
},
5959
},

packages/docs/src/games/endless-chase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const createGame: CreateGame = (_container) => {
6363
follow: true,
6464
color: {
6565
front: 'url("/nipplejs/assets/scope.svg") center/cover',
66-
back: 'radial-gradient(circle, rgba(56,189,248,0.12) 40%, rgba(56,189,248,0.03) 100%)',
66+
back: 'radial-gradient(circle, rgba(56,189,248,0.08) 0%, rgba(56,189,248,0.15) 85%, rgba(56,189,248,0.4) 93%, rgba(56,189,248,0.15) 100%)',
6767
},
6868
},
6969
position: { left: '0', top: '0', width: '100%', height: '100%' },

0 commit comments

Comments
 (0)