Activity › Forums › Adobe After Effects Expressions › Wiggle ON/OFF automatically whenever the object moves?
-
Wiggle ON/OFF automatically whenever the object moves?
Posted by Magnus Hellmen on January 9, 2017 at 9:18 amWhen 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.
Dan Ebberts replied 9 years, 4 months ago 3 Members · 10 Replies -
10 Replies
-
James Ronan
January 10, 2017 at 11:06 amSomething 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
-
Magnus Hellmen
January 10, 2017 at 4:28 pmMany thanks for the reply, I’ll make an attempt and see if I can get it working.
-
Magnus Hellmen
January 13, 2017 at 6:42 pmThe script works great, thanks. I’ve been trying to modify it to only affect the Y-axis but I can’t do it.
-
James Ronan
January 13, 2017 at 8:25 pmDo 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?
-
Magnus Hellmen
January 13, 2017 at 10:27 pmIt 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.
-
Dan Ebberts
January 13, 2017 at 10:43 pmMaybe something like this:
wFreq = 5;
wAmt = (speed != 0) ? 25 : 0;
w = wiggle(wFreq,wAmt);
[value[0],w[1]]Dan
-
Magnus Hellmen
January 14, 2017 at 1:30 pmThanks guys,
Dan how would I go about implementing your code in James script?
-
Magnus Hellmen
January 14, 2017 at 7:41 pmOkay 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?
-
Dan Ebberts
January 14, 2017 at 8:09 pmJust 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
Reply to this Discussion! Login or Sign Up