Interpolate
This function has been deprecated. Instead use TweenService to smoothly animate the Camera, see the code snippets below for an example.
For thread safety, this property is not safe to read in an unsynchronized thread.
This function tweens the Camera in a linear fashion towards a new Camera/CFrame and Camera/Focus over a given duration, for example:
local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable camera:Interpolate( CFrame.new(0, 10, 100), CFrame.new(0, 0, 100), 5 )
Throughout the tween, the Camera|Camera’s Camera/CFrame will be orientated towards the Camera|Camera’s Camera/Focus.
When the tween has completed, the Camera|Camera’s Camera/InterpolationFinished event will fire.
If this function is called while the Camera is already tweening the older tween will be stopped (without firing Camera/InterpolationFinished) and overridden by the new tween.
Interpolate can only be used if the current Camera/CameraType is ’Scriptable’, regardless of whether the default camera scripts are being used. If it is used with any other Camera/CameraType an error will be thrown.
You are advised to use TweenService to tween the Camera instead as it is more reliable and offers a variety of easing styles. See below for an example:
local TweenService = game:GetService("TweenService")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local tween = TweenService:Create(
camera,
TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{
CFrame = CFrame.new(0, 10, 100),
Focus = CFrame.new(0, 0, 100)
}
)
tween:Play()
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
|
|
The |
||
|
|
The |
||
|
|
The duration, in seconds, of the tween |
Returns
| Return Type | Summary |
|---|---|
|
No return |