ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Combining Ease and Wizz script with inertial bounce expression

FAQ   •   VIEW ALL
 Combining Ease and Wizz script with inertial bounce expression on Feb 12, 2014 at 12:13:39 pm

Hi,

I'm not sure if this is possible but is there a way to combine the Ease and Wizz script with an inertial bounce expression. I know with Ease and Wizz there is a bounce back option but I would like to bounce a property in both directions with a decay like inertial bounce.

Basically I'm looking for a way to get more a dynamic move (like Ease and Wizz allows) with a bouncy pendulum-like decay (which inertial bounce allows).

Thanks in advance.

 Return to posts index

 Re: Combining Ease and Wizz script with inertial bounce expressionon Feb 13, 2014 at 5:57:30 pm

Without knowing exactly what you're trying to animate (I was somewhat unclear anyway), it's hard to come up with a solution. Do you want a pendulum expression? Dan Ebberts wrote one for that on his site http://www.motionscript.com

Jason Jantzen
vimeo.com/jasonj

 Return to posts index

 Re: Combining Ease and Wizz script with inertial bounce expressionon Feb 13, 2014 at 11:50:19 pm

Hi 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 (http://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 (http://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

 Return to posts index

 Re: Combining Ease and Wizz script with inertial bounce expressionon Feb 14, 2014 at 12:00:29 am

I totally get it. I'm actually very interested in something similar. I'm not an expression guru, so I just do it manually. Something that helps to sell the effect when you do it manually is some soft body collision or squash and stretch.

I'll be watching the thread for an expression that solves this :)

Jason Jantzen
vimeo.com/jasonj

 Return to posts index

 Re: Combining Ease and Wizz script with inertial bounce expressionon Feb 17, 2014 at 4:29:54 pm

keyframing lop

 Return to posts index

© 2018 CreativeCOW.net All Rights Reserved
[TOP]