FORUMS: list search recent posts

Automating a simple 'walk' cycle

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
James Huenergardt
Automating a simple 'walk' cycle
on Jul 10, 2012 at 6:31:57 pm

Hi,

I'm working on a project where I'm doing some very simple animation using 2D characters.







What I'm wanting to do is figure out how to automate a very simple 'in/out/scissors' style walk cycle when I move the character left or right.

I want the legs to rotate in and out like the video link above when I move the character's position so the faster I move him, the faster his legs move, or the slower I move him, the more slowly they go.

It's kind of like moving a car along the x-axis and having the wheels rotate around as it moves, but the wheels do that automatically.

Is this even possible?

Thanks,

Jim

Reel Inspirations - http://www.reelinspirations.com
Commercials, Dramas, Image Pieces, Documentaries, Motion Graphics


Return to posts index

Dan Ebberts
Re: Automating a simple 'walk' cycle
on Jul 10, 2012 at 9:01:05 pm

It's hard to see the walk cycle in the linked video, but you should be able to set up a relationship between total horizontal distance moved and rotation angle. It's hard to be more specific without knowing exactly what you're trying to do.

Dan



Return to posts index

James Huenergardt
Re: Automating a simple 'walk' cycle
on Jul 10, 2012 at 9:52:37 pm

Here is a better example of what I'm after:







Reel Inspirations - http://www.reelinspirations.com
Commercials, Dramas, Image Pieces, Documentaries, Motion Graphics


Return to posts index


Dan Ebberts
Re: Automating a simple 'walk' cycle
on Jul 11, 2012 at 12:25:31 am

This isn't perfect, but I think it's close. It assumes that the legs are parented to a layer named "body", and body is keyframed to move horizontally. This would be the expression for rotation of the left (your left) leg:


body = thisComp.layer("body");
len = height; // length of leg
a = 15; // max angle
startX = body.transform.position.valueAtTime(inPoint)[0];
stride = 2*len*Math.sin(degreesToRadians(a));
d = (body.transform.position[0] - startX)%stride;
if (d < stride/2)
angle = radiansToDegrees(Math.asin(d/len))
else
angle = radiansToDegrees(Math.asin((stride -d)/len));
angle



For the right leg, just change the last line to :

-angle


Dan



Return to posts index

James Huenergardt
Re: Automating a simple 'walk' cycle
on Jul 12, 2012 at 8:46:30 pm

Dan, you are a genius. Wow, that math is crazy.

I have no idea what is going on (for the most part) but was able to adjust stride, etc. to get things working nicely.

I'm a former programmer (Actionscript, Javascript, database, etc.) but never did crazy math like that.

Way cool. Thanks so much!

Reel Inspirations - http://www.reelinspirations.com
Commercials, Dramas, Image Pieces, Documentaries, Motion Graphics


Return to posts index

Mauricio Domingues
Re: Automating a simple 'walk' cycle
on Apr 16, 2013 at 10:29:06 pm

The expression works pretty well.
But the "legs" won't do the way back so the animation looks kinda jagged.
Anyone knows how to modify this?
Thanks in advance!


Return to posts index

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