Skip to content

API Variable PenState

github-actions[bot] edited this page Nov 24, 2026 · 1 revision

Variable: PenState

const PenState: DataComponentDef<{
  deltaX: ScalarType<"f32">;
  deltaY: ScalarType<"f32">;
  down: ScalarType<"i32">;
  held: ScalarType<"i32">;
  inRange: ScalarType<"u8">;
  pressure: ScalarType<"f32">;
  tiltX: ScalarType<"f32">;
  tiltY: ScalarType<"f32">;
  twist: ScalarType<"f32">;
  up: ScalarType<"i32">;
  x: ScalarType<"f32">;
  y: ScalarType<"f32">;
}>;

Defined in: src/engine/input/deviceEntities.ts:72

The pen this frame (it appears when first sensed): held/down/up bitmasks (bit 0 the tip touching, 1 the barrel button, 2 the eraser), position x/y in canvas pixels and movement deltaX/deltaY (+Y down), pressure 0..1, tiltX/tiltY -1..1 (±90°, +Y toward the user), twist 0..1 of a turn, and inRange 1 while hovering or touching.

Clone this wiki locally