Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Cascading traffic jam animation

  • Cascading traffic jam animation

    Posted by Skylar Moran on March 28, 2018 at 9:29 pm

    Hello!

    I’m working on an animation of an overhead shot of a road with a traffic jam on it. I want the cars to move in a cascading “stop-and-go” traffic method along the road’s path. So far I’ve gotten the cars spacing and path right by using expressions to link a slider to a null’s path, and linking the car’s position to the slider with an offset to each one.

    slider = thisComp.layer("POS CONTROL").effect("Slider Control")("Slider")
    t = slider * thisComp.frameDuration
    Nullpos = thisComp.layer("Null 4").transform.position
    Nullpos.valueAtTime(t-insert delay here)

    I need to add something to this expression that will also delay each car in time, perhaps by the same that their position is delayed so that they start and stop in a sequenced manner. Or maybe there’s a more elegant solution that could address all these issues. Any ideas?

    Thanks in advance!

    Skylar Moran replied 8 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Jamie Bradshaw

    March 29, 2018 at 9:30 am

    If you made each car a child of the parent in front of it, then this code should give you the effect I think you’re after?


    delay = effect("delay")("Slider");
    parent.fromWorld(toWorld(anchorPoint,time-delay));

    JimJam•Graphics
    https://www.jimjamgraphics.com/

  • Skylar Moran

    March 29, 2018 at 4:54 pm

    Thank you!!

    This is great! Except for one weird thing, The delay is working correctly, but when I parent the layer, and then again when I apply the delay expression, the layer shifts from the path I want it to follow. It ends up to the side and way ahead of the parent layer. I was able to fix it by just manually moving the layer into place, but I’m not sure why it’s doing this. Here’s the expression as I have it now.

    slider = effect("position")("Slider")
    t = slider * thisComp.frameDuration
    Nullpos = thisComp.layer("Null 4").transform.position
    Nullpos.valueAtTime(t)
    delay = effect("delay")("Slider")
    parent.fromWorld(toWorld(anchorPoint,time-delay));

    Also, do you know how I could get the delay to work on a frame basis rather than seconds? Like, if I set the delay slider to 1, that delays it 1 frame rather than 1 second?

    Thank you!

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