Skip to main content
Inspiring
October 26, 2022
Question

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

  • October 26, 2022
  • 1 reply
  • 161 views

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 ! 

 

 

This topic has been closed for replies.

1 reply

Mylenium
Legend
October 26, 2022

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