axis
SourceDerives one signed axis from two opposing booleans.
Helpers
Pure helpers for normalizing boolean directional input into typed axes and movement vectors.
This module is runtime-agnostic: it does not know about keyboard events, gamepads, or host APIs. It only translates already-sampled booleans into the compact movement values used by the examples.
Reach for it in the gap between host input sampling and ECS simulation: capture raw button state in the host, normalize it here, then write the resulting axes or vectors into resources/components for systems to consume.
// Normalize one sampled host input snapshot into a movement vector.
const movement = InputAxis.vectorFromAxes({
left: false,
right: true,
up: false,
down: false
})
Pure helpers that reduce opposing booleans to one explicit signed movement axis.
Derives one signed axis from two opposing booleans.
Runtime-agnostic helpers that derive branded movement vectors from normalized input.