reactions library

Reactions for flutter3d games: what an event looks and feels like — particle bursts, smoke that lingers, the camera kicked, shaken or widened, a pulse in the hand, a flash on the screen, and the sound that goes with them.

A Reaction is a decision, not an effect: a game decides it from a step or from its events, a test asserts it with no device, and the frame performs it (Reaction.showIn, Reaction.feel). A ReactionTable keeps the decisions keyed by event type, and ReactionsPlugin hears the engine's bus on its frame channel through one.

Classes

Felt
What the camera does about something, as a description rather than a call.
Haptic
A pulse of the device in the player's hand, as a description.
Jolt
Which of a camera's three verbs a Felt is.
Lingering
Something that keeps emitting for a while after the event that caused it.
Reaction
Everything one step showed, felt and sounded like, decided rather than performed.
ReactionBuilder
A Reaction being filled: what the rules of a ReactionTable write into.
ReactionContext<T extends BusEvent>
What a ReactionRule is handed: the event, and the reaction it writes into.
ReactionEffect
Something a reaction does that has no field of its own on Reaction: a moment of slow motion, a rumble in a pad's two motors, a light that flares.
ReactionsPlugin
A ReactionTable heard from the engine's bus, on the frame channel.
ReactionTable
Reactions keyed by event type: the game's own table of what each event looks and feels like.
ScreenFlash
A full-screen flash that fades: how bright it is now, between nought and whatever it was last fired at.

Typedefs

ReactionRule<T extends BusEvent> = void Function(ReactionContext<T> rule)
What one rule of a ReactionTable does with an event of type T.