ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud

Bounce y pos at each marker

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andres TorresBounce y pos at each marker
by on Sep 16, 2012 at 6:37:39 pm

I'm simply trying to write an expression to bounce y position at each marker. My current code produces unnatural results where the position immediately jumps at each marker.

Thanks.

n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time){
n--;
}
}

if (n == 0){
value;
} else {
freq = 1.0; //oscillations per second
amplitude = 90;
decay = .5;
t = time - marker.key(n).time;

posCos = Math.abs(Math.cos(freq*t*2*Math.PI));
y = amplitude*posCos/Math.exp(decay*t);
position - [0,y]
}


Return to posts index

Dan EbbertsRe: Bounce y pos at each marker
by on Sep 16, 2012 at 7:34:54 pm

Just change Math.cos to Math.sin

(Edit) Actually, I'd also change posCos to posSin, just so the variable name would match what it's used for.

Dan



Return to posts index

Andres TorresRe: Bounce y pos at each marker
by on Sep 16, 2012 at 8:22:31 pm

Thanks Dan, you're amazing.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2016 CreativeCOW.net All Rights Reserved
[TOP]