ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Cascading traffic jam animation

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Skylar Moran
Cascading traffic jam animation
on Mar 28, 2018 at 9:29:54 pm
Last Edited By Skylar Moran on Mar 28, 2018 at 9:30:48 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-<b>insert delay here</b>)


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!


Return to posts index

Jamie Bradshaw
Re: Cascading traffic jam animation
on Mar 29, 2018 at 9:30:55 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
http://www.jimjamgraphics.com/


Return to posts index

Skylar Moran
Re: Cascading traffic jam animation
on Mar 29, 2018 at 4:54:37 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!


Return to posts index

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