LerpAngle

From Garry's Mod
Jump to: navigation, search
 LerpAngle( )

Contents

Description

Returns point between first and second angle using given fraction and linear interpolation

Arguments

number ratio

Ratio of progress through values

Arguments

Angle angleStart

Angle to begin from

Arguments

Angle angleEnd

Angle to end at

Returns

Angle

angle

Examples

Example

Turns an entity 180 degrees uses lerp over ten seconds

local startAngle = Angle(0, 0, 0)
local endAngle = Angle(0, 180, 0)
local ratio = 0

timer.Create("Turn", 0.1, 10, function()
    ratio = ratio + 0.1
    entity:SetAngles(Lerp(ratio, startAngle, endAngle))
end)


Personal tools
Navigation