|
34 | 34 | const dh = ih * scale; |
35 | 35 | const dx = (state.w - dw) * 0.5; |
36 | 36 | const dy = (state.h - dh) * 0.5; |
| 37 | + const mobile = Math.max(0, Math.min(1, state.w / 900)); |
37 | 38 |
|
38 | | - // Near-black but visible. No animation. |
39 | | - ctx.filter = "grayscale(1) contrast(1.05) brightness(0.20)"; |
40 | | - ctx.globalAlpha = 0.9; |
| 39 | + // Near-black but visible, with stronger darkening on mobile. |
| 40 | + const brightness = 0.14 + mobile * 0.06; // ~0.166 on iPhone widths, ~0.20 desktop |
| 41 | + const baseAlpha = 0.62 + mobile * 0.28; // reduce image weight on smaller screens |
| 42 | + ctx.filter = `grayscale(1) contrast(1.05) brightness(${brightness.toFixed(3)})`; |
| 43 | + ctx.globalAlpha = baseAlpha; |
41 | 44 | ctx.drawImage(img, dx, dy, dw, dh); |
42 | 45 |
|
43 | 46 | // Slight dark veil so foreground content stays readable. |
44 | 47 | ctx.filter = "none"; |
45 | 48 | ctx.globalAlpha = 1; |
46 | | - ctx.fillStyle = "rgba(0, 0, 0, 0.35)"; |
| 49 | + const veil = 0.62 - mobile * 0.20; // stronger veil on mobile |
| 50 | + ctx.fillStyle = `rgba(0, 0, 0, ${veil.toFixed(3)})`; |
47 | 51 | ctx.fillRect(0, 0, state.w, state.h); |
48 | 52 |
|
49 | 53 | // Fade out toward the lower section so the art tapers off naturally. |
50 | | - const fadeBottom = ctx.createLinearGradient(0, state.h * 0.52, 0, state.h); |
| 54 | + const fadeStart = state.h * (0.44 + mobile * 0.08); |
| 55 | + const fadeBottom = ctx.createLinearGradient(0, fadeStart, 0, state.h); |
51 | 56 | fadeBottom.addColorStop(0, "rgba(0, 0, 0, 0)"); |
52 | | - fadeBottom.addColorStop(0.45, "rgba(0, 0, 0, 0.32)"); |
53 | | - fadeBottom.addColorStop(1, "rgba(0, 0, 0, 0.72)"); |
| 57 | + fadeBottom.addColorStop(0.45, "rgba(0, 0, 0, 0.40)"); |
| 58 | + fadeBottom.addColorStop(1, "rgba(0, 0, 0, 0.84)"); |
54 | 59 | ctx.fillStyle = fadeBottom; |
55 | 60 | ctx.fillRect(0, 0, state.w, state.h); |
56 | 61 |
|
|
0 commit comments