Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Mix numbers and characters to simulate a digital clock

  • Mix numbers and characters to simulate a digital clock

    Posted by Filip Stillerska on November 25, 2018 at 9:33 pm

    I’m trying to simulate the display of a digital clock in the format NN:NN (where “N” is a number). I’m trying to do this using two slider controls since I want to be able to control the numbers. However, I’m unable to mix the numbers from the slider controls with ” : “, it just results in an expression error.
    Any ideas?

    Filip Stillerska replied 7 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 26, 2018 at 12:00 am

    I think this does what your asking for:

    n1 = effect(“Slider Control 1”)(“Slider”);
    n2 = effect(“Slider Control 2”)(“Slider”);
    “” + n1 + “:” + n2

    but this might be better:


    function padZero(n){
    return (n < 10 ? "0" : "") + n;
    }
    n1 = effect("Slider Control 1")("Slider");
    n2 = effect("Slider Control 2")("Slider");
    padZero(n1) + ":" + padZero(n2)

    Dan

  • Filip Stillerska

    November 27, 2018 at 7:35 pm

    Thank you, both expressions worked perfectly!

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