Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Make wiggle random across compositions?

  • Make wiggle random across compositions?

    Posted by Wyclef Chron on December 3, 2014 at 10:01 pm

    hey, I’ve got several different compositions of the same object using the same wiggle value but when played the wiggle is all synced up and I want each composition to be different is there a way to add a random element to each wiggle? Do I just add seedRandom(index,true); before each wiggle expression? I don’t understand, I thought that the seed was pulled from the layer number so why would I have compositions with similar wiggles in them on different layers all synced up?

    Dan Ebberts replied 11 years, 5 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    December 3, 2014 at 10:35 pm

    Assuming each of your comp names ends in a different character, something like this should work:

    c = thisComp.name.substr(-1).charCodeAt(0);
    seedRandom(c,true);
    wiggle (1,100)

    In any case, there should be something different about each comp name that you could use to generate a unique seed.

    Dan

  • David Conklin

    December 3, 2014 at 10:42 pm

    The seed random is your best bet, but using index as an input isn’t going to help you if all your layers are the same index (i.e. if they’re all the 3rd layer in their respective comps). Additionally, the second argument to the seedRandom() function does not apply to wiggles.

    You will need to feed the seedRandom() function a value which will be unique for every layer in every comp. It’s hard to say without knowing your exact setup, but if you have numbered comps, for instance

    RENDERCOMP_1
    RENDERCOMP_2
    RENDERCOMP_3

    You could use the integer attached to the name by doing something like

    thisComp.name.match(/\d+$/gi);

    to extract the # from the name. I have also had success by counting the # of characters in layer names, total number of layers, etc. You just have to find something that is different about Comp A from Comp B and use that as your seed.. this is a pain in the rear if your comps are designed to be as identical as possible for versioning purposes.

    There has to be a better way to do this. Maybe someone else can chime in.

    David Conklin
    Motion Designer

  • Wyclef Chron

    December 3, 2014 at 10:47 pm

    That’s a pretty clever idea. How do you add seedRandom to behavior? like Wiggle – gelatin. If I try to add an expression to wiggle amount lets say, I see effect("Wiggle - gelatin")(1) and if I add seedRandom(1,true); before that it doesn’t do anything.

  • Wyclef Chron

    December 3, 2014 at 10:49 pm

    There probably will only be 12-15 comps I need to do this for. I like the idea of just pulling the number from the name as well.

  • Dan Ebberts

    December 3, 2014 at 10:51 pm

    I’m not sure what you’re referencing, but if you find the wiggle expression itself, you can add seedRandom() before the wiggle(), like in my example.

    Dan

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