ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getEasingValue

Function

getEasingValue

Server and clientMiscellaneousIdentical to MTA:SA

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 (Elastic curves).
fEasingAmplitudefloat, optional
Amplitude (Elastic curves).
fEasingOvershootfloat, optional
Overshoot (Back curves).

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)

See also