Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Pendulum Motion

  • Posted by Ross Mcdowell on April 24, 2008 at 3:30 pm

    Hello All!! Hope you are all well 🙂

    I am having abit of trouble making this composition I am working on look right. At the moment I have some objects which rotate depending on the levels of an audio track, the anchor point is placed at the top of the object, so they look slightly like they are swinging.
    I have managed to get the objects to swing, but at the moment it all looks slightly forced, a rise in audio levels cause the object to be pushed, which is great. But then a drop in audio levels causes the object to be pushed back, which looks wrong.

    Is there any way I can make it so that whenever the audio levels drop back down, that a pendulum motion takes over, until the next rise in audio level?

    At the moment I am simply using a linear function to control the rotation:

    linear(effect(“audioLevel”)(“Slider”),100,0,80,5);

    I just get the feeling that this small change will make my composition 100 times better. I have read a few tutorial including one here on creative cow about pendulum motion, but cant seem to apply it to what I am currently working on.

    Any links, info, ideas would be greatly appreciated 🙂

    Thanks so much!

    Ross McDowell
    Animation Student

    Dan Ebberts replied 18 years, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • Ross Mcdowell

    April 24, 2008 at 4:33 pm

    Hi again,

    Sorry I just wanted to add that I’ve worked out the pendulum motion, but I am now having a trouble in getting the motion to only be applied when there is a decrease in audio level.

    Any ideas about how to do this would be great 🙂

    Thanks

    Ross McDowell
    Animation Student

  • Ross Mcdowell

    April 24, 2008 at 5:11 pm

    erm….

    ****************************

    inc = 0.04;
    swingTime = 0;
    preValue = effect(“Slider Control”)(“Slider”).valueAtTime(time-inc);
    curValue = effect(“Slider Control”)(“Slider”).valueAtTime(time);

    if (curValue

  • Ross Mcdowell

    April 24, 2008 at 5:43 pm

    scrap that, not working at all.
    the initial motion after the audio drop takes it from one side to the other…not too sure why 🙁
    bugger.

    Ross McDowell
    Animation Student

  • Dan Ebberts

    April 24, 2008 at 6:13 pm

    This should help. It assumes that your audio levels are on the “Both Channels” slider created by Convert Audio to Keyframes.

    threshold = 10.0;
    amp = 25;
    freq = 1.1;
    decay = .9;

    audioLev = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

    above = false;
    frame = Math.round(time / thisComp.frameDuration);
    while (true){
    t = frame * thisComp.frameDuration;
    if (above){
    if (audioLev.valueAtTime(t) < threshold){ frame++; break; } }else if (audioLev.valueAtTime(t) >= threshold){
    above = true;
    }
    if (frame == 0){
    break;
    }
    frame–
    }
    if (! above){
    t = 0;
    }else{
    t = time – frame * thisComp.frameDuration;
    }

    angle = freq * 2 * Math.PI * t;
    amp * Math.sin(angle) / Math.exp(decay * t);

    Dan

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