MCPcopy Create free account
hub / github.com/LaVache-FR/AnimationUtil / Easing

Interface Easing

fr/lavache/anime/Easing.java:3–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1package fr.lavache.anime;
2
3public interface Easing {
4
5 /**
6 * Simple linear tweening - no easing.
7 */
8 Easing LINEAR = (t, b, c, d) -> c * t / d + b;
9 /**
10 * Quadratic easing in - accelerating from zero velocity.
11 */
12 Easing QUAD_IN = (t, b, c, d) -> c * (t /= d) * t + b;
13
14 ///////////// QUADRATIC EASING: t^2 ///////////////////
15 /**
16 * Quadratic easing out - decelerating to zero velocity.
17 */
18 Easing QUAD_OUT = (t, b, c, d) -> -c * (t /= d) * (t - 2) + b;
19 /**
20 * Quadratic easing in/out - acceleration until halfway, then deceleration
21 */
22 Easing QUAD_IN_OUT = (t, b, c, d) -> {
23 if ((t /= d / 2) < 1) return c / 2 * t * t + b;
24 return -c / 2 * ((--t) * (t - 2) - 1) + b;
25 };
26 /**
27 * Cubic easing in - accelerating from zero velocity.
28 */
29 Easing CUBIC_IN = (t, b, c, d) -> c * (t /= d) * t * t + b;
30
31
32 ///////////// CUBIC EASING: t^3 ///////////////////////
33 /**
34 * Cubic easing out - decelerating to zero velocity.
35 */
36 Easing CUBIC_OUT = (t, b, c, d) -> c * ((t = t / d - 1) * t * t + 1) + b;
37 /**
38 * Cubic easing in/out - acceleration until halfway, then deceleration.
39 */
40 Easing CUBIC_IN_OUT = (t, b, c, d) -> {
41 if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
42 return c / 2 * ((t -= 2) * t * t + 2) + b;
43 };
44 /**
45 * Quartic easing in - accelerating from zero velocity.
46 */
47 Easing QUARTIC_IN = (t, b, c, d) -> c * (t /= d) * t * t * t + b;
48
49 ///////////// QUARTIC EASING: t^4 /////////////////////
50 /**
51 * Quartic easing out - decelerating to zero velocity.
52 */
53 Easing QUARTIC_OUT = (t, b, c, d) -> -c * ((t = t / d - 1) * t * t * t - 1) + b;
54 /**
55 * Quartic easing in/out - acceleration until halfway, then deceleration.
56 */
57 Easing QUARTIC_IN_OUT = (t, b, c, d) -> {
58 if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
59 return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
60 };

Callers 2

EasingInterface · 0.65
updateMethod · 0.65

Implementers 8

Elasticfr/lavache/anime/Easing.java
Backfr/lavache/anime/Easing.java
ElasticInfr/lavache/anime/Easing.java
ElasticOutfr/lavache/anime/Easing.java
ElasticInOutfr/lavache/anime/Easing.java
BackInfr/lavache/anime/Easing.java
BackOutfr/lavache/anime/Easing.java
BackInOutfr/lavache/anime/Easing.java

Calls 1

easeMethod · 0.65

Tested by

no test coverage detected