Question
combine two expressions in one overshoot and anticipation
i have this overshoot expression :
MaximumAmplitude = .1;
Frequency = 1.0;
Decay = 4.0;
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;}
if (n > 0){v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
if (t < 2){value + v*MaximumAmplitude*Math.sin(Frequency*t*2*Math.PI)/Math.exp(Decay*t)}
else{value;}}
else{value}
and i have this anticipation expression
var PeriodForElastic = 0.8;
var AmplitudeForElastic = 50;
var OvershootAmount = 1.70158;
function easeandwizz_inBack(t, b, c, d)
{return c*(t/=d)*t*((OvershootAmount+1)*t - OvershootAmount) + b;}
function easeAndWizz() {var n = 0;if (numKeys > 0) {n = nearestKey(time).index;
if (key(n).time > time) { n-- }}
try {var key1 = key(n);var key2 = key(n+1);}
catch(e) {return null;}var dim = 1;
try {key(1)[1];dim = 2;key(1)[2];dim = 3;}
catch(e) {}t = time - key1.time;d = key2.time - key1.time;sX = key1[0];eX = key2[0] - key1[0];
if (dim >= 2) {sY = key1[1];eY = key2[1] - key1[1];
if (dim >= 3) {sZ = key1[2];eZ = key2[2] - key1[2];}}
if ((time < key1.time) || (time > key2.time)) {return value;}
else {val1 = easeandwizz_inBack(t, sX, eX, d, AmplitudeForElastic, PeriodForElastic, OvershootAmount);
switch (dim) {case 1:return val1;break;
case 2:val2 = easeandwizz_inBack(t, sY, eY, d, AmplitudeForElastic, PeriodForElastic, OvershootAmount);return [val1, val2];break;
case 3:val2 = easeandwizz_inBack(t, sY, eY, d, AmplitudeForElastic, PeriodForElastic, OvershootAmount);val3 = easeandwizz_inBack(t, sZ, eZ, d, AmplitudeForElastic, PeriodForElastic, OvershootAmount);return [val1, val2, val3];break;default:return null;}}}(easeAndWizz() || value);i want to combine them to use it on one layer and have both anticipation and overshoot
is that possible ??
Nb : if u have another expression that already dose both anticipation and overshoot that will be more ideal!
