Phaser API Documentation

shake([duration], [intensity], [force], [callback], [context])


Shakes the Camera by the given intensity over the duration specified.


name type arguments Default description
duration number <optional> 100

The duration of the effect in milliseconds.

intensity number | Phaser.Math.Vector2 <optional> 0.05

The intensity of the shake.

force boolean <optional> false

Force the shake effect to start immediately, even if already running.

callback function <optional>

This callback will be invoked every frame for the duration of the effect. It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.

context any <optional>

The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.


This Camera instance.

Since: 3.0.0
Source: src/cameras/2d/Camera.js (Line 392)