Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Randomizing time remapping to create animated grass

  • Randomizing time remapping to create animated grass

    Posted by Sergio Pol on September 10, 2022 at 2:00 am

    Hello, I’m working on a project that I intend to export to Lottie. I need to make a hill with grass waving to the wind and had a very nice one that ended up incompatible with Lottie files since it had transformation effects on. So now I’ve manually made grass in a sequence of different slants in Illustrator that make the impression of the grass being blown with different strengths of wind in either direction. I brought it to AE and it looks ok but when I apply the time remapping in pingpong mode it looks awfully mechanical, as one would expect. I tried adding one expression to give it randomness but it just jumps randomly between frames. I’d need an expression that makes the time remapping play randomly forward and backward, therefore, suggesting the incidence of wind blowing on it.

    I think a way to achieve it would be to manipulate the grass timeline with time as the driver of an “ease” method but honestly, I don’t know where to begin. Any help would be greatly appreciated.

    Sergio Pol replied 3 years, 11 months ago 2 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    September 10, 2022 at 6:20 am

    You could try playing around with a time remapping expression like this:

    freq = 1;
    mid = (key(1).time + key(numKeys).time)/2;
    w = wiggle(freq,mid) - value;
    mid + w
  • Sergio Pol

    September 12, 2022 at 3:30 am

    I’m sorry I missed your reply. Thanks a lot, Dan, it’s amazing how you come up with the simplest of expressions that work perfectly. I’m trying to figure out how to make it not go to the extremes so often, it looks kind of unnatural to go from extreme wind towards one direction to extreme wind in the other in almost immediate order. I don’t want to delete those grass states since they’re where the wind effect is more evident but I’d love to limit the frequency the wind reaches that kind of strength. Those extreme wind states are at each end of the timeline, which now has a duration of 24 frames. Do you have any suggestions on how to do it? Thanks again!!

  • Dan Ebberts

    September 12, 2022 at 1:51 pm

    I guess you could limit the amplitude of the wiggle by changing the third line to something like this:

    w = wiggle(freq,mid*0.75) - value;

    but then it would never get to the extreme edges, so I’m not sure that’s what you want either.

  • Sergio Pol

    September 12, 2022 at 5:16 pm

    Yes, that’d be the same as deleting the most extreme states. However, I found that lowering the frequency it gets a little more natural. I guess that’s all I can get. Now I’d like to make it a loop, I’ve been trying to figure out how to blend this with your looping wiggle expression with no luck. Do you think is doable?

    Thanks for your help Dan.

  • Dan Ebberts

    September 12, 2022 at 5:33 pm

    Maybe like this:

    freq = 1;
    loopTime = 3;
    mid = (key(1).time + key(numKeys).time)/2;
    t = time % loopTime;
    wiggle1 = wiggle(freq, mid, 1, 0.5, t)-valueAtTime(t);
    wiggle2 = wiggle(freq, mid, 1, 0.5, t - loopTime)-valueAtTime(t-loopTime);
    w = linear(t, 0, loopTime, wiggle1, wiggle2);
    w + mid
  • Sergio Pol

    September 12, 2022 at 5:56 pm

    You’re the greatest. I’ll give it a try and get back to you. Thanks a lot Dan.

  • Sergio Pol

    September 12, 2022 at 7:48 pm

    Confirmed! it works perfectly! Thanks a lot Dan.

  • Sergio Pol

    September 12, 2022 at 8:11 pm

    I tried limiting the wiggle as you suggested and it looks even better. Without it looks too cartoony.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy