interpolateBetween
Shared
Interpolates between two sets of three numbers along an easing curve.
float, float, float interpolateBetween(float x1, y1, z1, float x2, y2, z2, float progress, string easingType [, float easingPeriod = 0.3, float easingAmplitude = 1, float easingOvershoot = 1.70158])
Parameters
| Name | Type | Description |
|---|---|---|
| x1, y1, z1 | float | The starting values. A vec3 also works. |
| x2, y2, z2 | float | The target values. A vec3 also works. |
| progress | float | The progress, from 0 to 1. |
| easingType | string | The easing curve, such as "Linear", "InOutQuad", "OutBounce" or "SineCurve". |
| easingPeriod | float | The period of the elastic curves.default 0.3 |
| easingAmplitude | float | The amplitude of the elastic and bounce curves.default 1 |
| easingOvershoot | float | How far the Back curves overshoot the target.default 1.70158 |
Returns
The three interpolated numbers. With progress at 1 or more, they are exactly the target ones when the curve ends there.
Example
local start = getTickCount()
addEventHandler("onClientRender", root, function()
local progress = math.min((getTickCount() - start) / 2000, 1)
local x, y = interpolateBetween(0, 0, 0, 400, 300, 0, progress, "InOutQuad")
dxDrawText("Hello", x, y)
end)