Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Triggering an expression function using a timeline marker

  • Triggering an expression function using a timeline marker

    Posted by Harold Durnez on November 10, 2020 at 3:24 pm

    ​Hi there

    I have the below ‘countdown timer’ expression working just fine.

    However now I would like to action this expression by use of a Layer Marker on my timeline.

    i.e. only when my timeline hits my marker at say 10 seconds, do I want this ‘countdown’ expression to start from the input time.

    rateOfSpeed = 1;

    clockStartTime = effect(“timer duration”)(“Slider”)*60;​ // This is a pickwhipped slider control

    function addZero(n){
    if(n<10) {return “0” + n}else{return n};
    }

    clockTimeNumber = Math.floor(clockStartTime – rateOfSpeed*time);

    clockTimeNumber/60;

    minutes = Math.floor(clockTimeNumber/60);
    seconds = clockTimeNumber%60
    minutes + “:” + addZero(seconds);

    } else {
    value
    }

    Harold Durnez replied 5 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Filip Vandueren

    November 10, 2020 at 3:58 pm

    Instead of this part clockTimeNumber = Math.floor(clockStartTime – rateOfSpeed*time);

    Try this:

    t = time - thisComp.marker.key(1).time;
    if (t<0) t=0;
    clockTimeNumber = Math.floor(clockStartTime - rateOfSpeed*t);

    Keep the rest of the expression the same, although there seems to be something missing in the part you pasted here (it endse with an else-clause, but there’s no if before it)

  • Harold Durnez

    November 10, 2020 at 5:07 pm

    That worked perfectly thanks Filip!
    to answer your question; the IF is hiding in the addZero function.


    To further this, what would need to be added to pause and unpause this timer using markers?


    Thanks man, Lifesaver!

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