Gavin Murdoch
Forum Replies Created
-
Thanks for your response. I have got this far but I was hoping for an expression that would like the creation of the dotted line to the movement of the bee comp.
-
Thanks for the advice. Makes sense. Looks like quite a bit of layer copying, alpha matting and pre-comping is on the menu….
-
Should have mentioned that. I’m looking to add some subtle movement to the position of circular shapes which make up the overall image.
-
Gavin Murdoch
February 13, 2014 at 11:50 pm in reply to: Combining Ease and Wizz script with inertial bounce expressionHi Jason,
Thanks for your response. I am not trying to animate anything specific. I am more looking for a generic solution to be used at a future date in a similar way to the inertial bounce expression (see below) for a pendulum like decay on either position, rotation or any other attribute for that matter.// Inertial Bounce (moves settle into place after bouncing around a little)
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);
amp = .05;
freq = 4.0;
decay = 2.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}The problem with the inertial bounce expression is that it only accepts linear keyframes as far as I am aware.
With Ease and Wizz (https://ianhaigh.com/easeandwizz/) you are offered far more interesting ways to interpolate between values. i.e. (Expo, Circ, Quint, Quart etc.) These give far more dynamic movement than using easy ease or linear keyframes. Here is the Ease and Wizz expression for moving between two position values using the Expo algorithm.
// Ease and Wizz 2.0.4 : Curvaceous : inOutExpo : all keyframes
// Ian Haigh (https://ianhaigh.com/easeandwizz/)
// Last built: 2013-07-05T11:46:51+10:00
function easeandwizz_inOutExpo(t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t – 1)) + b;
return c/2 * (-Math.pow(2, -10 * –t) + 2) + b;
}
function easeAndWizz() {
var n = 0;
if (numKeys > 0) {
n = nearestKey(time).index;
if (key(n).time > time) { n– }
}
// after the first two keys, yet before the last two, just do nothing
if (n > 1 && n < numKeys -1 ) {
return null;
}
try {
var key1 = key(n);
var key2 = key(n+1);
} catch(e) {
return null;
}t = time – key1.time;
d = key2.time – key1.time;
sX = key1.time;
eX = key2.time – key1.time;
if ((time < key1.time) || (time > key2.time)) {
return null;
} else {
return valueAtTime(easeandwizz_inOutExpo(t, sX, eX, d));
}
}
(easeAndWizz() || value);So basically, what I am after is a way of combining these two expressions to enable me to have a far more dynamic keyframe interpolation as is offered with Ease and Wizz but also incorporating a pendulum like decay which is achieved with inertial bounce.
Does that make things any clearer?
Many thanks,
Gavin -
Hi Kevin,
Thanks again. This seems to be working now. Even if I move the first stroke end keyframe beyond the zero position the expression is working as you intended. Great work!Cheers,
Gavin -
Hi Kevin,
Many thanks for your breakdown and explanation. This makes sense. However when I insert the more foolproof version of the expression the circle doesn’t follow the stoke end property.
Am I right in assuming that the edited expression should read:
end = effect(“Stroke”)(“End”);
valueAtTime(key(numKeys).time-key(1).time *end/100)Many thanks,
Gavin
-
Hi Kevin,
Many thanks again for your solution.
I wonder if you could take a moment to explain to me exactly how this expression is working:
end = effect(“Stroke”)(“End”);
valueAtTime(key(numKeys).time*end/100)I would like to understand so that I can hopefully write something like this in the future rather than a copy and paste job.
Thanks again,
Gavin -
Wow, awesome work!
I think I’ll go with the second option since that allows me to use ease and whizz expressions on the strokes ‘end’ property.
Thanks so much for taking the time to answer. Top job!
Gav