Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects decimal place expression

  • decimal place expression

    Posted by Sascha1979 on October 26, 2007 at 10:50 am

    hi.
    can anybody help me with some expression.
    i need a random expression only for the decimal place of a number.
    the number is 4,xx the two decimal place number should be randomized. it would be good if i also can change the random speed…

    thanks for help

    Darby Edelen replied 18 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Darby Edelen

    October 26, 2007 at 3:22 pm

    First let me say that I’m sure there are a few different ways to do this, but here’s how I would:

    base = 4;
    seedRandom(index);
    dec = random(0,99) / 100;
    base + dec;

    The easiest way to change the ‘speed’ of a random() function in AE is to use the posterizeTime(x); function which only returns the value of the expression x times per second:

    base = 4;
    seedRandom(index);
    posterizeTime(1);
    dec = random(0,99) / 100;
    base + dec;

    Would return a new random 4.xx number once every second, you could use a Slider expression control on the layer to control the posterizeTime() function.

    It should be mentioned that there will still be jumps from number to number using this method (as they are still random numbers, only they are evaluated less frequently). If you want smoother transitions between values you should use the wiggle(); expression.

    Darby Edelen
    DVD Menu Artist
    Left Coast Digital
    Aptos, CA

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