Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themorgantown/be0617f57ad0a40477b48a50c0d66844 to your computer and use it in GitHub Desktop.
Save themorgantown/be0617f57ad0a40477b48a50c0d66844 to your computer and use it in GitHub Desktop.
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