Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Randomise Position based on layer marker

  • Randomise Position based on layer marker

    Posted by Rosie Skinner on April 12, 2018 at 3:00 pm

    Hi everyone!

    I have this script for randomising the position on a layer

    random([thisComp.width,thisComp.height])

    but I’d really like the position to change at a layer marker… anyone got any ideas?

    Thanks!

    Rosie Skinner replied 8 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 12, 2018 at 4:02 pm

    Try this:


    m = marker;
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (m.key(n).time > time) n--;
    }
    seedRandom(n,true);
    random([thisComp.width,thisComp.height])

    Dan

  • Rosie Skinner

    April 12, 2018 at 4:08 pm

    Genius! Thank you!!

    If you have a bit of time would you mind explaining it?

    No worries if not!

  • Dan Ebberts

    April 13, 2018 at 12:34 am

    It looks for the most recent, previous marker and uses that marker’s index as the random seed (it uses zero, if there is no previous marker).

    Dan

  • Rosie Skinner

    April 13, 2018 at 9:18 am

    Great thanks so much!

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