- Documentation
- Shared functions
- getEasingValue
Function
getEasingValue
Returns the value of an easing curve for progress 0-1: Linear, InQuad, OutQuad, InOutQuad, OutInQuad, InElastic, OutElastic, InOutElastic, OutInElastic, InBack, OutBack, InOutBack, OutInBack, InBounce, OutBounce, InOutBounce, OutInBounce, SineCurve, CosineCurve. Useful for smooth interface animations.
Syntax
float getEasingValue(float fProgress, string strEasingType [, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot])Arguments
fProgressfloat- Progress 0-1.
strEasingTypestring- The curve type.
fEasingPeriodfloat, optional- Period (
Elasticcurves). fEasingAmplitudefloat, optional- Amplitude (
Elasticcurves). fEasingOvershootfloat, optional- Overshoot (
Backcurves).
Returns
The curve value.
Example
local start = getTickCount()
addEventHandler("onClientRender", root, function()
local p = math.min(1, (getTickCount() - start) / 600)
local x = 300 * getEasingValue(p, "OutBack")
dxDrawRectangle(x, 200, 80, 30, tocolor(255, 122, 34))
end)