# Shake

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

In Try it, the crate drops every two seconds and its script calls `camera.Shake(0.9)` when it lands. Raise Max Angle or lower Exponent and Decay on the camera to feel the difference.

Shake is driven by trauma, a value from 0 to 1 per output. `camera.Shake(0.4)` adds trauma, which fades by [Decay](/ref/camera.CameraShake2D.html#camera.CameraShake2D.Decay.md) per second. The view moves by up to [Max Offset](/ref/camera.CameraShake2D.html#camera.CameraShake2D.MaxOffset.md) and turns by up to [Max Angle](/ref/camera.CameraShake2D.html#camera.CameraShake2D.MaxAngle.md), scaled by trauma to the power [Exponent](/ref/camera.CameraShake2D.html#camera.CameraShake2D.Exponent.md), so small hits stay subtle. Without a Camera Shake 2D on the active camera the defaults are used.

The motion comes from deterministic noise, so a replay shakes the same way, and it never touches the node's transform or the game's random numbers.

Trauma adds up and fades in real time. With the default Decay of 1.5 a hit of 0.6 is gone in 0.4 seconds:

```aes run
package demo

import (
    "aego/camera"
    "aego/log"
)

script Hits {
    var frames int

    func Ready() {
        camera.Shake(0.6)
        log.Info("hit, trauma " + string(camera.Trauma()))
    }

    func Update(dt float) {
        frames++
        if frames % 6 == 0 && frames <= 30 {
            log.Info("trauma " + string(camera.Trauma()))
        }
        if frames == 30 {
            camera.Shake(0.5)
            camera.Shake(0.8)
            log.Info("two hits, capped at " + string(camera.Trauma()))
        }
    }
}
```

## Accessibility

Settings → Accessibility → Screen Shake scales every shake; 0 turns it off. Reduce Motion turns shake off and removes lookahead. Trauma still fades, so gameplay that reads `camera.Trauma()` is not affected.
