Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Module shake

Module shake 

Source
Expand description

Screen-shake counter.

The cheapest possible “the world reacted” feedback. A single frame counter; tick() decrements it and returns a small (dx, dy) offset the caller adds to their vertex positions.

Triangle-wave pattern – sign flips each frame so it reads as a judder rather than a smooth drift. Magnitude decays linearly with the counter, so the last frames are subtle.

§Example

ⓘ
let mut shake = ShakeState::new();
// On impact:
shake.trigger(6);
// Every frame, folded into rendering:
let (dx, dy) = shake.tick();
draw_game_world_at_offset(dx, dy);

Structs§

ShakeState
Frame-countdown that emits a judder offset.