Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Pendulum effect, affected by leader layer.

  • Dan Ebberts

    February 3, 2009 at 2:33 am

    Expressions aren’t very suited to this type of physical simulation because you really need to be able to keep track of things that happened in the past. It would be much easier in Flash ActionScript where variables persist from frame to frame. It’s not impossible, just challenging.

    Dan

  • Rhett Robinson

    February 5, 2009 at 5:00 pm
    freq = 1.0; //oscillations per second 
    amplitude = 50; 
    decay = 0; //no decay
    
    amplitude*Math.sin(freq*time*2*Math.PI)/Math.exp(decay*time)

    Depending on how you want it to “react”, it may not be all that difficult. I’ve snagged this bit of Dan’s code from his site at

    https://www.motionscript.com/mastering-expressions/simulation-basics-3.html

    which you should check out. I’m still a real novice at expressions (I’ve got a day job), but I’ve learned a lot here.

    I’ve usually just linked the variables to slider control effects on a null object, but a little bit of simple math applied instead (such as changing the amplitude based on the y position of a “leader layer”) shouldn’t be that tough.

    I would suggest that you get your pendulum layer in place and attach the code, then pickwhip the required change in the code to the the desired leader property, then change the code a little to divide/multiply/subtract/add etc. the resulting number until you get what you want.

    One of the reasons that I’ve usually used an expression control effect is that you can keyframe them, which may get what you want without it truly being controlled by your “leader”.

  • Alain Lores

    February 5, 2009 at 8:12 pm

    thanks for you replies, I’ll try and see how far i can get with key framing the “leader” the only problem is i really hoped for a dynamic solution but i can only imagine how complex the coding will be to get this type of result.

    Thank you dan, your expressions has helped the quality of my work a great deal.

  • Rhett Robinson

    February 5, 2009 at 11:11 pm

    Okay, so you don’t have to keyframe, I said you could. Otherwise a very simple (even I can do it) kind of mod to Dan’s expression script will take you a long way as a “dynamic” choice.

    What kind of interaction are you hoping to achieve? If the pendulum is supposed to *stop* at the top, then restart, that’s a different issue…

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