First I'd like to clarify that I'm by no means a professional programmer. However, I do dabble in motion graphics, and have just recently begin working with expressions. I have posted this same question in the Graphic Design stackexchange, but decided to also post here just in case.
I'm currently making an animation where I have multiple objects "explode" from the center and then wiggle around. I'm doing this in the most basic way: position keyframes and wiggle expression. However, I've used an ease and whizz script so the explosion happens smoothly, and applying the wiggle expression right after it makes it look weird.
Here's the animation as it currently is. Note that the object on the right moves erratically and different from the rest.
https://i.imgur.com/FE0UfLQ.gif
And here's the full lenght of the script of the erratic boi. This is from the Ease and Whizz plugin, plus the very very basic wiggle expression at the end.
So my question is: how do I make it so the wiggle expression only starts after the ease and whizz has ended? I know the wiggle expression accepts time values, but honestly I've never done anything that complex.
function easeandwizz_inoutQuint(t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + 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;
}
// determine how many dimensions the keyframes need
var dim = 1; // It's gotta have at least ONE dimension
try {
key(1)[2];
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[2];
eY = key2[2] - key1[2];
if (dim >= 3) {
sZ = key1[2];
eZ = key2[2] - key1[2];
}
}
if ((time < key1.time) || (time > key2.time)) {
return value;
} else {
val1 = easeandwizz_inoutQuint(t, sX, eX, d);
switch (dim) {
case 1:
return val1;
break;
case 2:
val2 = easeandwizz_inoutQuint(t, sY, eY, d);
return [val1, val2];
break;
case 3:
val2 = easeandwizz_inoutQuint(t, sY, eY, d);
val3 = easeandwizz_inoutQuint(t, sZ, eZ, d);
return [val1, val2, val3];
break;
default:
return null;
}
}
}
(easeAndWizz() || value);
wiggle(1,20);
[1]: https://i.stack.imgur.com/NSzaA.gif
[2]: https://i.stack.imgur.com/cBrMV.gif