UNPKG

threed-garden

Version:

ThreeD Garden: WebGL 3D Environment Interface for Next.JS React TypeScript Three.JS React-Three Physics, 2D Paper.JS; APIs: Apollo GraphQL, WordPress; CSS: Tailwind, Radix-UI; Libraries: FarmBot 3D; AI: OpenAI, DeepSeek

14 lines (11 loc) 376 B
import { Color } from "three"; export function useHeightMap() { const floorColor = new Color().setHSL(0.75, 1, 0.5); const ceilingColor = new Color().setHSL(0, 1, 0.5); const zmin = 0.05; const zmax = 0.5; return (height: number): Color => { const percent = (height - zmin) / (zmax - zmin); return floorColor.clone().lerpHSL(ceilingColor, percent); }; }