Created
March 27, 2020 18:46
-
-
Save themorgantown/be0617f57ad0a40477b48a50c0d66844 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amp = .09; // The larger the value, the greater the amplitude | |
freq = 2; // The higher the value, the higher the frequency | |
decay = 5; // The larger the value, the less the decay | |
n = 0; | |
if (numKeys > 0){ | |
n = nearestKey(time).index; | |
if (key(n).time > time){ | |
n--; | |
} | |
} | |
if (n == 0){ | |
t = 0; | |
}else{ | |
t = time - key(n).time; | |
} | |
v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t); | |
// In Tumult Hype's Math function editor, we can extract this function, where T is the time as a percentage of the duration of the animation. | |
function (t, start, dur) { | |
var amp = .13; // The larger the value, the greater the amplitude | |
var freq = .5; // The higher the value, the higher the frequency | |
var decay = .4; // The larger the value, the less the decay | |
return t * amp * Math.sin(freq * t * 2 * Math.PI) / (decay * t); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment