-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTupleEasing.pde
44 lines (35 loc) · 922 Bytes
/
TupleEasing.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
abstract class TupleEasing extends EasingSource < Tuple > {
abstract Tuple applyUnclamped(Tuple a, Tuple b, float t, Tuple out);
}
class TupleLerp extends TupleEasing {
Tuple applyUnclamped(Tuple a, Tuple b, float t, Tuple out) {
float u = 1.0 - t;
out.set(u * a.x + t * b.x,
u * a.y + t * b.y,
u * a.z + t * b.z);
return out;
}
}
class TupleEaseIn extends TupleLerp {
float exp = 1.675;
TupleEaseIn() {
}
TupleEaseIn(float exponent) {
exp = exponent;
}
Tuple applyUnclamped(Tuple a, Tuple b, float t, Tuple out) {
return super.applyUnclamped(a, b, pow(t, exp), out);
}
}
class TupleEaseOut extends TupleLerp {
float exp = 1.675;
TupleEaseOut() {
}
TupleEaseOut(float exponent) {
exp = exponent;
}
Tuple applyUnclamped(Tuple a, Tuple b, float t, Tuple out) {
return super.applyUnclamped(a, b,
1.0 - pow(1.0 - t, exp), out);
}
}