Phaser API Documentation

  Version: 
setLerp([x], [y])

Description:

Sets the linear interpolation value to use when following a target.

The default values of 1 means the camera will instantly snap to the target coordinates. A lower value, such as 0.1 means the camera will more slowly track the target, giving a smooth transition. You can set the horizontal and vertical values independently, and also adjust this value in real-time during your game.

Be sure to keep the value between 0 and 1. A value of zero will disable tracking on that axis.

Parameters:

name type arguments Default description
x number <optional> 1

The amount added to the horizontal linear interpolation of the follow target.

y number <optional> 1

The amount added to the vertical linear interpolation of the follow target.

Returns:
Description:

This Camera instance.

Since: 3.9.0
Source: src/cameras/2d/Camera.js (Line 609)