component

Trees

L-system trees grown by a 3D turtle, deterministic from seed.

⌖ Explore the library in 3D →

Add it

npx runek add trees

Pulls core, @react-three/rapier@^2.2.0, three@^0.184.0.

Use it

import { Trees } from './runek/Trees'

<Trees position={[0, 0, 0]} seed={1} />

Props

export interface TreesProps {
  position?: Vec3
  rotation?: Vec3
  seed?: number
  iterations?: number
  /** Base branch length, in units. */
  segmentLength?: number
  /** Branching angle, in radians. */
  angle?: number
  /** Defaults to the world palette's `bark` slot. */
  trunkColor?: string
  /** Defaults to the world palette's `foliage` slot. */
  leafColor?: string
}

See it live with editable props in the gallery →.