Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions “Playing” a layer…

  • “Playing” a layer…

    Posted by Royce Jacobs on July 15, 2011 at 10:26 am

    I am trying to “play” a video (16 frame animation) on command. I am using audio converted to keyframes (recording of a single note played multiple times, different rhythms), and I want to write an expression saying every time a note is played (>6.0 value would work for each note’s beginning), this 16 frame animation plays through and then freezes on the last frame (0:00:00:15). It’s important that it stops on the last frame of that layer while the rest of the timeline continues on. The effect would be that the animation is the note being played each time, in sync with the audio. But it needs to be an expression because it is too long to do manually.

    Anyone know how to do this?…..

    enable=effect("Enable Bounce")("Checkbox");
    soundLVL = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
    if( enable == 1){
    if(soundLVL >6){
    ***play a layer and freeze on last frame***;}
    else{

    };
    }else{

    }

    Lukas Thorsson replied 14 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Lukas Thorsson

    July 18, 2011 at 10:55 am

    Hey Royce,

    this is complicated but not impossible. I don’t have the time to hack something together right now, but for the first step I can tell you how it works:

    PreComp the 16 frames animation to a Comp of the length of your Animation, so you don’t have to check for freezing the last Frame later on, you just play the freezed Frame until the next event.

    The Expression you work on is in the TimeRemap Value of the PreComp.
    You have to Travel Back in Time by using a for-loop from current Time to zero. In the For Loop you check if

    soundLVL.valueAtTime(framesToTime(i)) > 6 && soundLVL.valueAtTime(framesToTime(i)-1) < 6

    is true… that means the value at current frame he checks is more than six, and the value at the frame before is less than 6. If that is the case save the current frame he checked in a variable and leave the loop using break;.
    You now got the last Start Time of your Animation. Then just play from lastStartTime.
    time – lastStartTime

    If you know some Expressions you might get it to work like this, but its not that simple…

    I’ll check later on.

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