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

How to get the Random expression returning same value across duplicated comp ?

Explorer ,
Oct 26, 2022 Oct 26, 2022

Copy link to clipboard

Copied

Hello, 

I've put this expression in the rotation of a layer : 

 

x = thisComp.layer("settings").effect("X Range")("Slider");

seedRandom(index, true);

random(-x,x)+value

 

And when I duplicate the composition, I have a different rotation. 
I'm not sure how Random expression works but I was assuming that with "seed random" to "true", I would fix the randomness in time and with "offset" linked to "index", also across comps... but no.

 

Here is what I want to achieve :

A bunch of layer that change them rotation based on index. Then the possibility to control the range of roation with a slider. And when I duplicate the comp, all the rotations remain the same. Here is the project in attachement. If anyone can help... Thanks a lot ! 

 

vtgaming1_0-1666800697962.png

 

TOPICS
Expressions , Scripting

Views

68

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
LEGEND ,
Oct 26, 2022 Oct 26, 2022

Copy link to clipboard

Copied

LATEST

You can dial in a fixed value instead of index, of course. That aside, in order to get "global" random values it is usually best to expose them on a control like a slider or a point control. A 3D point will give you three usable slots, for instance, and can be accessed across comps. So there's your answer: create dedicated layers with controls in one comp (ideally the parent comp that holds all you sub-comps) and link them, either as the seed for further seedRandom() functions orbas directly usable values for your rotations. You can even use a text layer with multiple entries, but then you have to decompose the array to extract the value and may need to put up with other extra stuff like parseFloat() to convert numbers to values.

 

Mylenium 

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