Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Position animation triggered by audio

  • Position animation triggered by audio

  • Ivan Matic

    July 16, 2021 at 7:11 pm

    I need to write expression for position that will be triggered when audio pass specific value and it can repeat multiple throw video.
    I tried with:

    if(thisComp.layer(“muzika”).effect(“Both Channels”)(“Slider”)>=85){



    And it works, but I want to add linear expression to y position, but dont know how to write to get time value

  • Yoan Boisjoli

    July 19, 2021 at 7:18 pm

    Hi Ivan !

    instead of [100, 100] you could write something like:

    linear(time, 0, 1, 0, 100)

    It converts time from 0 second to 1 second to the position 0 to 100. Feel free to play with the values. Also if you want something a bit smoother, you can change the word “linear” to ease, easeIn or easeOut

    Enjoy !

  • Ivan Matic

    July 19, 2021 at 8:18 pm

    Thanks for the answer, but what would happen if animation need to start again before previous one isnt finished.

    Animation need to follow bass on music, so i may happen there are overlapping

  • Ivan Matic

    July 20, 2021 at 2:46 pm

    Also if i writte expresion just with if and linear, it while now execute, beacuse next frame value is less then 85, and it back [0,0]

  • Ivan Matic

    July 21, 2021 at 2:33 pm

    I found solution that work for me, here is expression:

    threshold = 85.0;

    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){




    }else if (audioLev.valueAtTime(t) >= threshold){

    above = true;


    if (frame == 0){





    if (! above){

    t = 0;


    t = time - frame * thisComp.frameDuration;



Viewing 1 - 5 of 5 posts

Log in to reply.

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