Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Randomize numbers between 1 and 9. Stops at Marker with comment

  • Randomize numbers between 1 and 9. Stops at Marker with comment

    Posted by Huub Borns on December 22, 2017 at 3:15 pm

    Hi there.

    I’m doing a charity event were I want the total amount gotten to count up.

    I don’t want to animate the text because it’s linked in Element 3D. And would like to keep it to 1 layer.
    So i’ve tried doing it with an expression.

    The text randomizes between 0 and 9. When it hits a marker with a comment, the text changes to the markers comment.
    This works for the 2D text. But in the Element 3D layer, after it hits the marker it still keeps randomizing.

    Is there another possibility to do this?

    Cheers.

    Huub

    m = thisComp.layer("CIJFER 1");
    n=0;
    if (m.marker.numKeys > 0){
    n = m.marker.nearestKey(time).index;
    if (m.marker.key(n).time > time) n--;
    }

    if (n >0) {
    m.marker.key(n).comment
    }else{
    Math.round(random(0,9));
    }

    Kalleheikki Kannisto replied 8 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kalleheikki Kannisto

    December 23, 2017 at 8:21 am

    Works just fine for me. Do your E3D, text and marker layers start at the samepoint (the beginning of the comp?)

    Kalleheikki Kannisto
    Senior Graphic Designer

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