Skip to main content
Participant
February 15, 2024
Question

Using "seedRandom" and "holdTime" to generate position values

  • February 15, 2024
  • 1 reply
  • 824 views

I'm using `seedRandom` to produce random position coordinates on a layer. I'm also using `holdTime` to only change position once every second. Is there a way to keep this function but also seed the randomization so that when applying the expression to other layers I can get the same random values?

I don't think I can have them parented to the same null object or just in the same pre-comp because I need to apply different layer styles and masks to different layers but I'd still like for some of them to have the same randomized positions.

Below is the current expression I'm using.

`var holdTime = 1;

seed = Math.floor(time/holdTime);
seedRandom(seed,true);
x = gaussRandom(0,1920);
y = gaussRandom(0,1080);

[x,y]`

 

This topic has been closed for replies.

1 reply

Inspiring
February 16, 2024

You can choose a random seed by hard coding a value, but instead of the hold time code, you can simply add 

`posterizeTime(1)` to the top to update the expression once a second. This allows you to set the frame rate for a given property as opposed to a layer or the entire composition. https://ae-expressions.docsforadobe.dev/global.html?highlight=posterizetime#posterizetime-updatespersecond