Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x 47x | import { Texture } from 'pixi.js';
import type { HUDTextOptions } from '../pixi-kit/index.ts';
/**
* Synesthesia skin tokens, after a cosmic particle world: a true-black void, a world built from ember / gold particles,
* electric blue and magenta as the only cool accents, and hairline frames with lock-on corners instead of glass.
* Type is wide and technical — Orbitron for Latin labels and numerals, M PLUS 1p Light for Japanese and titles.
*/
export const SYN_VOID = 0x010000;
export const SYN_DEEP = 0x0c0402;
export const SYN_INDIGO = 0x1a0904;
export const SYN_GLASS = 0x060302;
/** Electric blue — the cool accent (black keys, below-clear gauge, FAST). */
export const SYN_CYAN = 0x46c4ff;
export const SYN_MAGENTA = 0xff3d9e;
export const SYN_EMBER = 0xff6a14;
export const SYN_AMBER = 0xffb23a;
export const SYN_FLARE = 0xffe7b8;
export const SYN_VIOLET = 0x9c7cff;
export const SYN_GREEN = 0x7dffb4;
export const SYN_RED = 0xff4a4a;
export const SYN_WHITE = 0xffffff;
export const SYN_MIST = 0xf1dcc8;
export const SYN_DIM = 0xb4a28e;
/** Orbitron has no Japanese: a Japanese label falls through to M PLUS 1p. */
export const SYN_DISPLAY_FONT = 'Orbitron, M PLUS 1p, sans-serif';
export const SYN_TEXT_FONT = 'M PLUS 1p, ui-sans-serif, system-ui, sans-serif';
/**
* Base hue of the whole scene at `seconds`: a slow drift through the red-orange → amber band (the world's ember light),
* nudged forward on each beat so colour literally keeps time with the music.
*/
export function sceneHue(seconds: number, beatPhase = 0): number {
const drift = 0.075 + 0.025 * Math.sin(seconds * 0.11);
return drift + 0.015 * (1 - beatPhase) ** 2;
}
let glowTexture: Texture | undefined;
/**
* Soft radial glow sprite (white core falling off to transparent), generated once on a 2D canvas and tinted per use.
* Falls back to Pixi's 1x1 white texture where no DOM canvas exists (headless benchmarks).
*/
export function synGlowTexture(): Texture {
if (glowTexture) return glowTexture;
if (typeof document === 'undefined') return Texture.WHITE;
const size = 64;
const canvas = document.createElement('canvas');
canvas.width = size;
canvas.height = size;
const context = canvas.getContext('2d');
if (!context) return Texture.WHITE;
const gradient = context.createRadialGradient(size / 2, size / 2, 0, size / 2, size / 2, size / 2);
// A hot, wide core so small sprites still read as sparks, falling off into a soft halo.
gradient.addColorStop(0, 'rgba(255,255,255,1)');
gradient.addColorStop(0.24, 'rgba(255,255,255,0.95)');
gradient.addColorStop(0.42, 'rgba(255,255,255,0.5)');
gradient.addColorStop(0.7, 'rgba(255,255,255,0.12)');
gradient.addColorStop(1, 'rgba(255,255,255,0)');
context.fillStyle = gradient;
context.fillRect(0, 0, size, size);
glowTexture = Texture.from(canvas);
return glowTexture;
}
/** Radius (px) of the visible glow for a sprite of `displaySize` px — the texture fades out well before its edge. */
export const SYN_GLOW_SIZE = 64;
/** The HUD's small label type: dim, wide Orbitron. */
export function labelStyle(): HUDTextOptions {
return { size: 9, fill: SYN_DIM, fontFamily: SYN_DISPLAY_FONT, letterSpacing: 0.8 };
}
/** The HUD's figures: Orbitron at `size` in `fill`. */
export function displayStyle(size: number, fill: number): HUDTextOptions {
return { size, fill, fontFamily: SYN_DISPLAY_FONT, weight: '400' };
}
|