Camera colors: dynamic green-cyan-white spectrum instead of flat green

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kbanc85 2026-02-15 13:05:55 -05:00
parent 681ffa275b
commit 9fd19824ab
1 changed files with 22 additions and 6 deletions

View File

@ -34,12 +34,28 @@ function brightnessToChar(b: number, x: number, y: number): string {
return CAM_FULL[h % CAM_FULL.length];
}
function brightnessToGreen(b: number): string {
function brightnessToColor(
b: number,
x: number,
y: number,
t: number
): string {
if (b < 0.05) return "";
const clamped = Math.min(b, 1);
const l = 15 + clamped * 50;
const s = 50 + clamped * 30;
return `hsl(120,${s}%,${l}%)`;
// Slow-drifting phase creates shifting color bands across the frame
const phase = Math.sin(x * 0.2 + y * 0.15 + t * 0.4) * 0.5 + 0.5;
// Hue sweeps green (130) → teal → cyan (190) based on position + time
const hue = 130 + phase * 60;
// Vivid for dark pixels, desaturating toward white for bright areas
const s = Math.max(70 + phase * 20 - clamped * 35, 15);
// Darker pixels dim, brighter pixels approach white
const l = 18 + clamped * 57;
return `hsl(${hue | 0},${s | 0}%,${l | 0}%)`;
}
export function findBrightnessCentroid(
@ -173,7 +189,7 @@ export function createCameraScene(opts: CameraSceneOptions = {}): SceneDriver {
startCamera(target.width, target.height);
},
tick(_state: FluidState, target: RenderTarget, _time: number, _dt: number): boolean {
tick(_state: FluidState, target: RenderTarget, time: number, _dt: number): boolean {
if (!ready || !video || !canvas || !ctx || !brightness) return false;
const { width, height, spans } = target;
@ -204,7 +220,7 @@ export function createCameraScene(opts: CameraSceneOptions = {}): SceneDriver {
const span = spans[spanIdx];
const char = brightnessToChar(br, x, y);
const color = brightnessToGreen(br);
const color = brightnessToColor(br, x, y, time);
if (span.textContent !== char) span.textContent = char;
if (color) {