Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Date Shuffle Expression

  • Date Shuffle Expression

    Posted by Adam Henaghan on December 21, 2018 at 12:53 am

    Hey Folks,

    Fairly new to expressions and can’t seem to find a way to make this work

    I have my date laid out 01.22.19. Each day, month, year and period is a separate text layer.

    I’m hoping to randomly shuffle numbers at a legible speed with double digits through each day, month and year and have them separately restricted, i.e date to from 00 to 31, month from 00 to 12 and I’m not sure for year yet, maybe 00 to 99. Then finally landing on 01.22.19 after 3 seconds or so.

    Maybe this is asking too much, but if you know a way, I’ll be forever grateful.

    Adam.

    Adam Henaghan replied 7 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 21, 2018 at 1:19 am

    Something like this maybe:


    function padZero(n){
    return (n < 10 ? "0" : "") + n;
    }
    minVal = 1;
    maxVal = 31;
    finalVal = 22;
    dur = 3;
    changesPerSecond = 10;
    t = time - inPoint;
    if (t < dur){
    seed = Math.floor(t*changesPerSecond);
    seedRandom(seed,true);
    val = Math.floor(random(minVal,maxVal+1));
    }else{
    val = finalVal;
    }
    padZero(val);

    This is set up for day of the month, you’d adjust minVal, maxVal, and finalVal for month and year. Adjust dur and changesPerSecond to set the run time and speed.

    Dan

  • Adam Henaghan

    December 21, 2018 at 1:23 am

    Dan I love you! Worked perfectly.

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