ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Wiggle ON/OFF automatically whenever the object moves?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Magnus Hellmen
Wiggle ON/OFF automatically whenever the object moves?
on Jan 9, 2017 at 9:18:25 am

When I animate character movement I just wiggle them up and down quickly on the y-axis, south park-style to simulate leg movement.

I'm wondering if there's a way to create a character comp that wiggles like this whenever I change character position, and when the character is stationary the wiggle effect is zero.

That way I can focus on just the positioning of the character and the wiggle will sort itself out.


Return to posts index

James Ronan
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 10, 2017 at 11:06:03 am
Last Edited By James Ronan on Jan 10, 2017 at 11:07:13 am

Something like this?

pos = transform.position;
frameRate = thisComp.frameDuration /1;

if (pos.valueAtTime(time)[0] != pos.valueAtTime(time-frameRate)[0] || pos.valueAtTime(time)[1] != pos.valueAtTime(time-frameRate)[1] ){
wigVal = 10} else {
wigVal = 0;
}

wiggle(wigVal,10);


Thanks


Return to posts index

Magnus Hellmen
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 10, 2017 at 4:28:25 pm

Many thanks for the reply, I'll make an attempt and see if I can get it working.


Return to posts index


Magnus Hellmen
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 13, 2017 at 6:42:26 pm

The script works great, thanks. I've been trying to modify it to only affect the Y-axis but I can't do it.


Return to posts index

James Ronan
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 13, 2017 at 8:25:48 pm

Do you mean it wiggles along X and Y only when your moving along the Y axis, or it only wiggles on Y regardless of what axis your moving in?


Return to posts index

Magnus Hellmen
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 13, 2017 at 10:27:42 pm

It should only wiggle along the Y-axis regardless of what the layer movement is. When it wiggles on the x-axis it sometimes looks as if the character is jumping back but moving forward.


Return to posts index


Dan Ebberts
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 13, 2017 at 10:43:07 pm

Maybe something like this:

wFreq = 5;
wAmt = (speed != 0) ? 25 : 0;
w = wiggle(wFreq,wAmt);
[value[0],w[1]]


Dan



Return to posts index

Magnus Hellmen
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 14, 2017 at 1:30:36 pm

Thanks guys,

Dan how would I go about implementing your code in James script?


Return to posts index

Dan Ebberts
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 14, 2017 at 5:09:15 pm

It's an alternative, so you'd use it by itself.

Dan



Return to posts index

Magnus Hellmen
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 14, 2017 at 7:41:39 pm

Okay got you, thanks. It seems to work great, just need to tweak the values. Is it possible to save code snippets like these under Effects & Presets for easier access?


Return to posts index

Dan Ebberts
Re: Wiggle ON/OFF automatically whenever the object moves?
on Jan 14, 2017 at 8:09:48 pm

Just select the property with the expression, and then use Animation > Save Animation Preset... to save your preset in the default User Presets folder. It should then show up in the Effects & Presets panel the next time you launch AE.

Dan



Return to posts index

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