Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random text – dates.

  • Random text – dates.

    Posted by Tomek Suwalski on September 11, 2006 at 12:53 pm

    Hello everyone.

    I need to create a random calendar dates like ‘5 August’, ’16 January’, ’24 November’ and so on. Day and month does not matter I need to generate them randomly and be able to control speed beetween changing source text. I need it to kinda fly through history and just stop at certain dates. I’m not very good at expressions so if anyone could help me I’d really appreciate. Hope I made myself clear, if there are any doubts, please tell me, I’ll try to explain again.

    All the best.
    Tom

    Tomek Suwalski replied 19 years, 8 months ago 3 Members · 3 Replies
  • 3 Replies
  • Mylenium

    September 11, 2006 at 2:00 pm

    Apply a Slider expression control to your layer and rename it to “Randomizer”. Then use something like this on the source text property of a text layer:

    randomizer=thisLayer.effect(“Randomizer)(“Slider”);
    seedRandom(randomizer,true);

    month_names=[“January”,”March”,”August”];
    month_ID=Math.round(random(0,month_names.length));
    month_select=month_names[month_select];

    day_names=[“1″,”2″,”3″];
    day_ID=Math.round(random(0,day_names.length));
    day_select=day_names[day_select];

    [day_select+” “+month_select]

    This will create a new random combination whenever you change the slider value of the “Randomizer” (animate it to your taste). Fill in the other names as needed. For the fixed dates I’d simply hand-keyframe everything for simplicity’s sake.

    Mylenium

    [Pour Myl

  • Dan Ebberts

    September 11, 2006 at 3:16 pm

    I haven’t tried it, but it seems like you’d want to use Math.floor() instead of Math.round() to avoid an out-of-range index.

    Dan

  • Tomek Suwalski

    September 12, 2006 at 3:06 pm

    Thank you, guys, you’re awesome.

    You’re right Dan, there should be Math.floor() instead of Math.round() and there should be Month_ID and Day_ID in square brackets instead of Month_select and Day_select.

    And can you recall any more precise method to control rate of change, cause slider is very unprecise, at most values it changes text every frame, and for example when set to 0,0 at frame 0 and 0,01 at frame 30 it changes every 2:05. It would be nice to have a slider correspond to frames, say every 1,0 at slider means one text change.

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