1 person found this helpful
It's pretty simple but probably requires the right expression.
Not really. There is no way to access all aspects of keyframes with expressions like their tangents, so there is no way to use that info. All you ever get is the actual interpolated value using valueAtTime(), the rest AE will do for you. That said, even if it were possible, reconstructing the entire path inside the expression would not be trivial and then you'd have to throw the animation timing on top of it based on calculating the actual path lengths. So rather than looking for convoluted solutions like this, just keyframing it would be a lot quicker.
OK Mylenium. I didn't realise telling the comp to follow the bezier for 5 frames then to stop for 5 frames in a loop could turn out to be such a challenge for After Effects
Too bad, as you suggested, I'll just keyframe it manually I guess... I was hoping to also control the speed it goes along the path with a slider, but I suppose that will be for AE Creative Galaxy 2078 because clearly that would be such a futuristic thing to even think of...!
1 person found this helpful
I would approach this problem a little differently. If I understand you correctly you have basically created a walk cycle for your insect. Your desire is to make the moving legs match the movement along the ground so the legs don't look like they are slipping or the insect floating.
I have done this kind of thing quite often for everything from tires rolling on the ground to cartoon characters walking around a virtual set but I don't try and keyframe position to match movement I match movement to position. Let me explain.
Say you have a five frame walk cycle so your character - your bug - moves it's legs in one complete walk cycle in 5 frames. So far the only thing moving is the legs. If you nest a copy of your character in a new comp you can then use time remapping to control the speed of the moving legs. It's pretty easy to figure out how far the character would move for one walk cycle. Let's say that when the character layer is at 100% scale the main legs move 50 pixels in the first half of the walk cycle. In other words, in the case of a bug with six legs, the right front leg starts on the ground and moves back 50 pixels, then the right front leg comes off the ground and moves forward 50 pixels and repeats. Each step should then move the character forward 50 pixels. Now that you have that figured out it becomes a pretty easy thing to use time remapping in conjunction with position vectors to make the movement of the legs match the speed of the walk cycle. Move the character layer slowly and the legs move slowly, move the character layer quickly and the legs move quickly. You use vector math and tie the speed of the layer to the frame rate of the time remapping. Once you have that worked out you can use motion sketch or any other method to keyframe position and the animation of the legs will match up so your character will be stuck to the ground in a realistic way. Throw in scale or get really fancy and add in 3D layer properties and distance from the camera and this will still work perfectly.
I won't give you the expression for moving anywhere on the stage at any scale but here's a thread and an expression for matching a walk cycle to x position: Motion blur and looping a character walk cycle
Hi Rick, and thank you for your very detailed and interesting approach. I really appreciate your insights.
I haven't been able to figure out everything you said exactly yet, I've been reading it over and over for the past hour doing some tests
One of the things I'd appreciate more detail about, is this part:
use time remapping in conjunction with position vectors to make the movement of the legs match the speed of the walk cycle
Also, in my case, one comp loop of the walk lasts 01:17 (47 frames) because I kept 3 walk cycles, to have a bit more "random" than one single loop.
Still not sure how to make the insect move forward in steps instead of regularly, and then have this follow a bezier line this way, without having to keyframe everything...
1 person found this helpful
Rick thank you for sharing the expression! Baobaob I believe you need to look at this response of Rick: he even kindly shares an Aep File. the spatial movement of the whole spider in the master composition is the easy part, what is suggested here is that you connect the position value to the timeremapping via expression that measures the stride of the spider so when you move it in the composition window it will auto-magically move it's legs accordingly. there's math involved here but you have a project file. the moving part is easy - if you want it to follow a specific path you can paste the path to the position. or do it more randomly with Motion Sketch.
When you synchronize the walk cycle to time remapping all you have to do is keframe in the position and the legs will move exactly the way you want them to move.
The example I gave is extremely simple and only calculates movement on the X axis. The expression that uses velocity is a lot more complex. I have not decided whether to give that away as an animation preset because it is part of a package that I am about to put on the market. It is more than possible to use something as simple as motion sketch to animate the path and speed of your bug and keep the stride in sync by adding the right expression to time remapping. It takes nothing more than the math that is available in the expression language menu and a good understanding of geometry to create the expression that synchronizes stride with the position direction and velocity.