• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

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

New Here ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

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]`

 

TOPICS
Expressions

Views

142

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

LATEST

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-updatesper...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines