FORUMS: list search recent posts

randomseed alternative to 'index' ?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
jay dunn
randomseed alternative to 'index' ?
on Aug 16, 2012 at 1:29:51 am

I'm using wiggle(0,1000) to randomly position some layers in 3d space (lets say they're planets). Once I've done that, I start to set up my camera and the rest of the comp. The problem is that, as I add new layers/cameras etc, my planets start to jump around. This is because (i believe) the wiggle is using the layer's index as the random seed. I need the layers to stay where they are while I continue to build my comp I also need the wiggle expression to stay live, because I'm animating it (I can't simply bake the planet layers position once they are distributed in space.) Is there an alternative to the index random seed that will give me unique values for each layer, but won't change if the layer's index does?


Return to posts index

Dan Ebberts
Re: randomseed alternative to 'index' ?
on Aug 16, 2012 at 3:08:41 am

You could try calculating the seed from the characters in the layer's name. That wouldn't change if you moved the layer around:

seed = 0;
for (i = 0; i < name.length; i++) seed += name.charCodeAt(i);
seedRandom(seed,true);
wiggle(1,100)


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]