You are viewing an older version of the site. Click here to view
the latest version of this page. (This may be a dead link, if so, try the root page of the docs
here.)
== easing ==
[[../../Optimizer#CACHE_RETURN|CACHE_RETURN]]
[[../../Optimizer#NO_SIDE_EFFECTS|NO_SIDE_EFFECTS]] |}
Copy Code
The output would be:
Copy Code
The output would be:
Given an easing type, and a duration percentage x, returns the given resulting interpolation value.
=== Vital Info ===
{| style="width: 40%;" cellspacing="1" cellpadding="1" border="1" class="wikitable"
|-
! scope="col" width="20%" |
! scope="col" width="80%" |
|-
! scope="row" | Name
| easing
|-
! scope="row" | Returns
| double
|-
! scope="row" | Usages
| EasingType type, double x
|-
! scope="row" | Throws
| [[../objects/ms.lang.CastException|ms.lang.CastException]]
|-
! scope="row" | Since
| 3.3.5
|-
! scope="row" | Restricted
| No
|-
! scope="row" | Optimizations
| [[../../Optimizer#CONSTANT_OFFLINE|CONSTANT_OFFLINE]] [[../../Optimizer#CACHE_RETURN|CACHE_RETURN]]
[[../../Optimizer#NO_SIDE_EFFECTS|NO_SIDE_EFFECTS]] |}
Easing type may be one of EASE_IN_SINE, EASE_OUT_SINE, EASE_IN_OUT_SINE, EASE_IN_CUBIC, EASE_OUT_CUBIC, EASE_IN_OUT_CUBIC, EASE_IN_QUINT, EASE_OUT_QUINT, EASE_IN_OUT_QUINT, EASE_IN_CIRC, EASE_OUT_CIRC, EASE_IN_OUT_CIRC, EASE_IN_ELASTIC, EASE_OUT_ELASTIC, EASE_IN_OUT_ELASTIC, EASE_IN_QUAD, EASE_OUT_QUAD, EASE_IN_OUT_QUAD, EASE_IN_QUART, EASE_OUT_QUART, EASE_IN_OUT_QUART, EASE_IN_EXPO, EASE_OUT_EXPO, EASE_IN_OUT_EXPO, EASE_IN_BACK, EASE_OUT_BACK, EASE_IN_OUT_BACK, EASE_IN_BOUNCE, EASE_OUT_BOUNCE, EASE_IN_OUT_BOUNCE, or LINEAR and x must be a double between 0 and 1, or it is clamped. The return value may be less than zero or above one, depending on the easing algorithm. See http://easings.net/ for visual examples.
=== Usages ===
easing(EasingType type, double x)=== Examples === ====Example 1==== Usage with LINEAR interpolation. Given the following code:
for(@x = 0, @x <= 1, @x += 0.1) {
msg(@x . ': ' . easing('LINEAR', @x));
}

1 {{keyword|for}}(@x = 0, @x <= 1, @x += 0.1) {
2 {{function|msg}}(@x . ': ' . {{function|easing}}('LINEAR', @x));
3 }
0: 0.0 0.1: 0.1 0.2: 0.2 0.30000000000000004: 0.30000000000000004 0.4: 0.4 0.5: 0.5 0.6: 0.6 0.7: 0.7 0.7999999999999999: 0.7999999999999999 0.8999999999999999: 0.8999999999999999 0.9999999999999999: 0.9999999999999999====Example 2==== Usage with EASE_IN_SINE interpolation. Given the following code:
for(@x = 0, @x <= 1, @x += 0.1) {
msg(@x . ': ' . easing('EASE_IN_SINE', @x));
}

1 {{keyword|for}}(@x = 0, @x <= 1, @x += 0.1) {
2 {{function|msg}}(@x . ': ' . {{function|easing}}('EASE_IN_SINE', @x));
3 }
0: 0.0 0.1: 0.01231165940486223 0.2: 0.04894348370484647 0.30000000000000004: 0.1089934758116321 0.4: 0.19098300562505255 0.5: 0.2928932188134524 0.6: 0.41221474770752686 0.7: 0.5460095002604533 0.7999999999999999: 0.6909830056250525 0.8999999999999999: 0.8435655349597688 0.9999999999999999: 0.9999999999999997
Find a bug in this page? Edit this page yourself, then submit a pull request. (Note this page is automatically generated from the documentation in the source code.)