API Reference › Light › Light.spot
method

Light.spot

Light.spot(x, y, radius, color, energy, direction, spread)

Accumulates a **cone** (spot) light — like Light.point, but only the wedge aimed at direction degrees (measured from +x, counter-clockwise) within a half-angle of spread degrees receives light. Pixels outside the cone stay dark, and the last few degrees of the edge feather so the boundary is not a hard line. A spot shares every quality control with a radial light — Light.falloff, Light.soft, Light.gel and the normal buffer all apply. Fully deterministic (integer degrees + Q16.16).

Parameters

radiusthe reach in pixels; brightness is zero at and beyond it
colorthe light colour, 0x00RRGGBB
energya fixed brightness multiplier (1.0 = full)
directionthe aim, in whole degrees (0 = right, 90 = up, 180 = left)
spreadthe cone half-angle, in whole degrees (180 ≈ omnidirectional)

Example

program Demo {
  property Torch { x: int = 0, y: int = 0 }
  model Lamp { Torch }
  handler Render phase Update {
    Screen.clear(0)
    Light.ambient(Color.rgb(24, 24, 32))
    Light.spot(80, 60, 70, Color.rgb(255, 240, 200), 1.0, 0, 30)   # a flashlight pointing right
    Screen.show()
  }
}
← All symbols