Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions randomseed alternative to ‘index’ ?

  • randomseed alternative to ‘index’ ?

    Posted by Jay Dunn on August 16, 2012 at 1:29 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?

    Dan Ebberts replied 13 years, 11 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    August 16, 2012 at 3:08 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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy