Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Referencing another layers position only if size =0

  • Referencing another layers position only if size =0

    Posted by Markus Stone on August 12, 2019 at 3:18 am

    Hi all,

    I’m trying to build a trail of dots that emerge from the end of a line that travels along a path (think mouse pointer trails) and slowly shrink down to notheing. The catch is that once they have appeared, the dots must stay locked to the background (ie; not following the movement of the line that ‘gave birth to them’).

    I have an ellipse shape that shrinks down to nothing. It’s keyframed with a loopout in cycle mode. The idea is that once the layer hits a size of “0” I can move it to become the new dot, so I don’t have to have a new layer for every dot and the animation can be any length with the same overhead.

    I have a Null chasing the position of the end of the line.

    Thing is, I can’t get the expression to sample the new position from the Null *only when size is “0”.

    This is what I have;

    nullPos = thisComp.layer(“Null 2”).transform.position;
    if (content(“Ellipse 1”).content(“Ellipse Path 1”).size<=0)
    {
    nullPos;
    }
    else
    {
    value;
    }

    Currently, what happens is that the Ellipse just stays blinking in the one spot, or follows the position of the null at every frame.

    I thought the conditional ‘if’ statement would get around the fact that AE asseses expressions on each frame.

    I’m new to this – please help me before I eat my keyboard in frustration!

    Many Thanks

    Markus

    nullPos = thisComp.layer("Null 2").transform.position;
    if (content("Ellipse 1").content("Ellipse Path 1").size&lt;=0)
    {
    nullPos;
    }
    else
    {
    value;
    }

    Dan Ebberts replied 6 years, 9 months ago 2 Members · 4 Replies
  • 4 Replies
  • Markus Stone

    August 12, 2019 at 6:27 am

    I also tried this way, where I explicitly assign the value to thisPos and return that value. No luck.

    nullPos = thisComp.layer(“Null 2”).transform.position;
    thisPos = value;

    if (content(“Ellipse 1”).content(“Ellipse Path 1”).size <= 0)
    {
    thisPos=nullPos;
    }
    else
    {
    thisPos=value;
    }
    thisPos;

  • Markus Stone

    August 12, 2019 at 9:29 am

    I’m trying to do this https://youtu.be/bmPOEXVIOjc

    Such that it only ever requires six layers to render the dots.

    I know trapcode particular can do this, but trying to avoid spending $1000 when I feel this must be possible with expressions. Besides, I might learn something.

    M

  • Markus Stone

    August 16, 2019 at 4:52 am

    No takers? Is this harder than it looks?

  • Dan Ebberts

    August 16, 2019 at 8:58 pm

    It’s definitely do-able, but the algorithm is probably a little tricky. Basically, the expression for each layer has to know which of the 6 instances he is. Then based on the current time and the loop time it needs to calculate when his current cycle started and use that with valueAtTime() to get where the null was at that time. The details will depend on how you have things set up.

    Dan

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