ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Date Shuffle Expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Adam Henaghan
Date Shuffle Expression
on Dec 21, 2018 at 12:53:52 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.


Return to posts index

Dan Ebberts
Re: Date Shuffle Expression
on Dec 21, 2018 at 1:19:22 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



Return to posts index

Adam Henaghan
Re: Date Shuffle Expression
on Dec 21, 2018 at 1:23:28 am

Dan I love you! Worked perfectly.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]