Skip to content

color.map.twilight

Summary

color.map.twilight supplies a cyclic ramp for phase, direction or other periodic measurements. Its endpoints have similar colors so that values just before and after a full turn appear close in color. Wrap the input fraction before sampling because the map clamps its coordinates.

Syntax

twilight(): Colormap
const map = WasmGPU.color.map.twilight();

Returns

Colormap - Shared 256-texel, linearly filtered map with CPU and GPU sampling. Equivalent to WasmGPU.color.map.builtin("twilight").

Example

import WasmGPU from "@zushah/wasmgpu";

const angle = -Math.PI / 2;
const turns = angle / (2 * Math.PI);
const rgba = WasmGPU.color.map.twilight().sampleCPU(turns - Math.floor(turns));

See Also