Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Select random layer as a Value

  • Select random layer as a Value

    Posted by James Barry on June 20, 2015 at 8:40 am

    I’ve created randomly seeding dots that move, and I would like to connect the dots with lines. I’ve created the dots and I know to use BEAM to connect the dots using the dots positions as begin and end points for the BEAM.

    What I would like to do is to put in an expression for the beginning and end points for the BEAM an expression that randomly selects which dot is connected to the next dot.

    So like something like

    thisComp.layer("Dot (random number between 1-60)").transform.position

    With “Dot” being the layer names for the dots (eg: Dot 1, Dot 2, Dot 3, Dot 4, etc)

    Is this possible?

    Thank you in advance.

    James Barry replied 10 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 20, 2015 at 2:24 pm

    I haven’t test it, but this should work:

    thisComp.layer(“Dot ” + (Math.floor(random(60))+1)).transform.position

    Dan

  • James Barry

    June 20, 2015 at 4:25 pm

    Perfect, thanks.

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