Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Simple Postion Random Expression

  • Tom Granberg

    May 14, 2010 at 5:14 pm

    Great, here is a variation on the expression to lock one of the axis, as well as control the time interval the position changes.
    To precisely control where the axis position is, I used (+b) I am sure some guru on here will figure out a much better way, but I like it:-)

    Thanks to Dan!

    holdTime = .5; //time to hold each position (seconds)
    seed = Math.floor(time/holdTime);
    seedRandom(seed,true);

    numberOfXPositions = 1;
    numberOfYPositions = 30;

    a = 10; //fixed number value
    b = 512; //fixed number value

    x = Math.floor(random(numberOfXPositions))+b;
    y = Math.floor(random(numberOfYPositions))*a;
    [x,y]

  • Shawn Baden

    January 4, 2018 at 8:27 pm

    I’m trying to get a random number between 1 and length of text – I have this working. It gives me a random number for every frame. I only want it to find a random number once and keep the value. I’ve tried using seedRandom but it isn’t behaving the way I would expect. It gives me roughly half the value of the text length every time rather than from 1-10.

    max = thisComp.layer("myLayer").text.sourceTextlength + 1;

    seedRandom(1, true);
    Math.floor(random(1, max));

  • Dan Ebberts

    January 4, 2018 at 9:09 pm

    Did you try changing the seed to something else? What’s your sample size? random can look not-too-random until you have a lot of instances.

    Dan

  • Shawn Baden

    January 4, 2018 at 10:51 pm

    I’ve tried changing the thread to 0, 1, 5… I’m changing the value of the sourceText from 4 letters to 15 letters and it’s doing the same thing.

  • Shawn Baden

    January 5, 2018 at 2:28 am

    I’ve realized that it is pulling the value at frame 0 every time I change the length of my text string. In addition it creates the same “random” sequence of numbers for each string length. A string character count of 14 always starts with 7. The only way around this that I can think of is to randomly choose a frame in the sequence to pull the value from. This I’m guessing will just run into the same random() problems.

Page 2 of 2

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