ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

2 Random numbers - even and odd seconds

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Karel Hejkal
2 Random numbers - even and odd seconds
on Aug 17, 2017 at 10:26:47 am

Hello, I am fairly new to Expressions as I do animate mostly with the graphic only. I would like to ask you for a help.

What I try to do us something like rolling random numbers, similar to car odometer - please see the image, it will be random numbers that at the end will become the advent dates.



For that I need many numbers to roll down (0-9 or 0-999, that does not matter at the moment, not sure whether I will roll them independently or together). Right now I roll the row together.

So I have to generate them in the exact times - lets say every 2 seconds - and move from from top to bottom of the counter. That is what I can achieve (googled the code).

But I need more then one row of digits - when one row of numbers starts to disappear, the other slowly appears - otherwise there are long blank spaces on the roll.

And here is the problem - both rows randomly change at the same time. No matter how I move layers on the TL.

So I have to somehow offset the other row change interval in time for one second. To change, when the row is "hidden" . Is there a way how make the code being offset in the time for random number of seconds (or frames, which would need the expression to be bit different probably)?

Thanks a lot if anyone helps.

var holdTime = 2;
seedRandom(Math.floor(time/holdTime), timeless = true);
random(0,9);


Return to posts index

Kevin Camp
Re: 2 Random numbers - even and odd seconds
on Aug 17, 2017 at 5:41:40 pm

you could try making the time related to the inPoint of the layer rather than just comp time....

try this:
var holdTime = 2;
t = Math.max( 0, time - inPoint );
seedRandom(Math.floor(t/holdTime), timeless = true);
random(0,9);

the 2 second holdTime should start from the inPoint of the layer rather than the start of the comp, so you should be able slide them in the timeline to offset the timings of the number changes between text layers.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

Karel Hejkal
Re: 2 Random numbers - even and odd seconds
on Aug 18, 2017 at 8:50:02 am

Hello Kevin,

thanks a lot. Helped and saved a lot of time.

May I ask you more one little "side" question? I do work with AE very rarely. Usually once, twice a year. And it is not easy for me to manage to learn with such time lags in between. Usually I even forget the few shortcuts I have learned. Yet I have tried to search for some step by step Action script learning guide that would help me to cope the easiest, yet for me unreachable problems such as this one was. But I have never found anything that I would find easy enough for beginners so far.

Would you have some recommendation for some book or site that would help to learn from the tiniest steps to lets say semi experienced examples I could use for learning?

Anyway, thanks a lot, I'm into the making the animation alive 😉


Return to posts index


Kevin Camp
Re: 2 Random numbers - even and odd seconds
on Aug 18, 2017 at 5:58:52 pm

i've pretty much learned everything i know about expression from reading posts on this site (and asking a few questions), and from motionsript.com and from jjgifford.com/expressions/basics/index.html

on motionscript.com, a good place to start is the mastering expressionssection.

there's a fair amount of overlap between that mastering expression section and jj gifford's expression basics, but they are both good places to start.

i'm pretty sure that lynda.com has some good tutorials on expression too -- i'm not sure if this is true everywhere, but where i live, if you have a county library card, you get access to lynda.com for free...

in addition to learning expressions strictly for after effects, i find it's pretty easy to get answers to java-specific questions online too, sites like w3schools.com are good resources for basic java skills that can help with developing more complex expressions.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

Karel Hejkal
Re: 2 Random numbers - even and odd seconds
on Aug 21, 2017 at 8:52:26 am

Once again, Kevin, thanks a lot for your answer full of very useful information.

Not sure how can I give it back, but in case you ever needed something to do with graphic, be sure you can google and contact me.

Cheers,

Karel


Return to posts index

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