You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/core/Camera.js
+79-31Lines changed: 79 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ Phaser.Camera = function (game, id, x, y, width, height) {
109
109
this.lerp=newPhaser.Point(1,1);
110
110
111
111
/**
112
-
* @property {Phaser.Point} _targetPosition - Internal point used to calculate target position
112
+
* @property {Phaser.Point} _targetPosition - Internal point used to calculate target position.
113
113
* @private
114
114
*/
115
115
this._targetPosition=newPhaser.Point();
@@ -133,6 +133,7 @@ Phaser.Camera = function (game, id, x, y, width, height) {
133
133
duration: 0,
134
134
horizontal: false,
135
135
vertical: false,
136
+
shakeBounds: true,
136
137
x: 0,
137
138
y: 0
138
139
};
@@ -285,6 +286,46 @@ Phaser.Camera.prototype = {
285
286
286
287
},
287
288
289
+
/**
290
+
* This creates a camera shake effect. It works by applying a random amount of additional
291
+
* spacing on the x and y axis each frame. You can control the intensity and duration
292
+
* of the effect, and if it should effect both axis or just one.
293
+
*
294
+
* When the shake effect ends the signal Camera.shakeOnComplete is dispatched.
295
+
*
296
+
* @method Phaser.Camera#shake
297
+
* @param {float} [intensity=0.05] - The intensity of the camera shake. Given as a percentage of the camera size representing the maximum distance that the camera can move while shaking.
298
+
* @param {number} [duration=500] - The duration of the shake effect in milliseconds.
299
+
* @param {boolean} [force=true] - If a camera shake effect is already running and force is true it will replace the previous effect, resetting the duration.
300
+
* @param {number} [direction=Phaser.Camera.SHAKE_BOTH] - The directions in which the camera can shake. Either Phaser.Camera.SHAKE_BOTH, Phaser.Camera.SHAKE_HORIZONTAL or Phaser.Camera.SHAKE_VERTICAL.
301
+
* @param {boolean} [shakeBounds=true] - Is the effect allowed to shake the camera beyond its bounds (if set?).
0 commit comments