@@ -11,6 +11,7 @@ var Effects = require('./effects');
1111var EventEmitter = require ( 'eventemitter3' ) ;
1212var Linear = require ( '../../math/Linear' ) ;
1313var Rectangle = require ( '../../geom/rectangle/Rectangle' ) ;
14+ var SmoothStep = require ( '../../math/SmoothStep' ) ;
1415var TransformMatrix = require ( '../../gameobjects/components/TransformMatrix' ) ;
1516var ValueToColor = require ( '../../display/color/ValueToColor' ) ;
1617var Vector2 = require ( '../../math/Vector2' ) ;
@@ -318,6 +319,16 @@ var Camera = new Class({
318319 */
319320 this . lerp = new Vector2 ( 1 , 1 ) ;
320321
322+ /**
323+ * The values stored in this property are added to the follow target position, allowing you to
324+ * offset the camera from the actual target x/y coordinates by the followOffset amount.
325+ *
326+ * @name Phaser.Cameras.Scene2D.Camera#followOffset
327+ * @type {Phaser.Math.Vector2 }
328+ * @since 3.9.0
329+ */
330+ this . followOffset = new Vector2 ( ) ;
331+
321332 /**
322333 * Internal follow target reference.
323334 *
@@ -703,8 +714,8 @@ var Camera = new Class({
703714
704715 if ( follow )
705716 {
706- this . scrollX = Linear ( this . scrollX , follow . x - originX , this . lerp . x ) / zoom ;
707- this . scrollY = Linear ( this . scrollY , follow . y - originY , this . lerp . y ) / zoom ;
717+ this . scrollX = Linear ( this . scrollX , ( follow . x - this . followOffset . x ) - originX , this . lerp . x ) / zoom ;
718+ this . scrollY = Linear ( this . scrollY , ( follow . y - this . followOffset . y ) - originY , this . lerp . y ) / zoom ;
708719 }
709720
710721 if ( this . useBounds )
0 commit comments