-
Notifications
You must be signed in to change notification settings - Fork 0
/
easing-functions.js
50 lines (42 loc) · 2.06 KB
/
easing-functions.js
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
45
46
47
48
49
50
y = height / 2 - 100 + cosineFadePowMorer(i, 350, 150);
ellipse(x, y, 2);
}
}
function draw() {
}
function cosineFade(sum, dur, scale) {
var range = map(sum, 0, dur, 0, 1);
// var constrainedRange = constrain(normalizedRange, 0, 1);
// var fadeSmooth = constrainedRange * PI;
// var coFade = map(pow(cos(range),0.1), 1, 0.9402940372573783, 0, scale);
var coFade = map(cos(range), 1, 0.5403023058681398, 0, scale);
return coFade;
}
function cosineFadePow(sum, dur, scale) {
var range = map(sum, 0, dur, 0, 1);
// var constrainedRange = constrain(normalizedRange, 0, 1);
// var fadeSmooth = constrainedRange * PI;
var coFade = map(pow(cos(range), 0.1), 1, 0.9402940372573783, 0, scale);
// var coFade = map(cos(range), 1, 0.5403023058681398, 0, scale);
return coFade;
}
function cosineFadePowMore(sum, dur, scale) {
var range = map(sum, 0, dur, 0, 1);
// var constrainedRange = constrain(normalizedRange, 0, 1);
// var fadeSmooth = constrainedRange * PI;
var coFade = map(pow(cos(range), 0.01), 1, 0.9938626462668108, 0, scale);
// var coFade = map(cos(range), 1, 0.5403023058681398, 0, scale);
return coFade;
}
function cosineFadePowMorer(sum, dur, scale) {
var range = map(sum, 0, dur, 0, 1);
// var constrainedRange = constrain(normalizedRange, 0, 1);
// var fadeSmooth = constrainedRange * PI;
var coFade = map(pow(cos(range), 0.000001), 1, 0.9999993843737192, 0, 1);
// var coFade0 = map(pow(cos(range),0.000001), 1, 0.9999993843737192, 0, 1);
coFade = map(cos(coFade), 1, 0.5403023058681398, 0, scale);
// coFade = lerp(coFade0, coFade2, 0.5);
// var coFade = map(cos(range), 1, 0.5403023058681398, 0, scale);
return coFade;
}
// 0.9993845629887088