rotationSensor

How far a 3D shape has rotated, as a 2D pan you can move content by.

rotationSensor(frame: SurfaceFrame): {x: Expr; y: Expr}

Import materials from shaders/std and use materials.rotationSensor.

Zero on flat shapes and on any shape at rest, growing as the shape turns. Constant across the frame, so it pans a star field or a backdrop without shearing it. Needs pattern: 'raw'.

Parameters

NameTypeNotes
frameSurfaceFrame

Example

const pan = rotationSensor(frame)

See also

  • shellRefract — Coordinates for what sits inside a glass shell, bent where the shell curves.
  • surfacePattern — Coordinates for a pattern that sticks to the shape's surface.

Used by

Nebula