Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Opacity – position

  • Opacity – position

    Posted by Jaka Stucin on October 2, 2007 at 11:39 am

    I have a question (tried to find it, but couldn’t), why doesn’t this work:
    if (thisComp.layer(“Null 5”).transform.position[0] > 310 || thisComp.layer(“Null 5”).transform.position[0] < 410) 100 else 0
    put in Opacity of the solid,
    while this works:
    if (thisComp.layer(“Null 5”).transform.position[0] < 310 || thisComp.layer("Null 5").transform.position[0] > 410) 0 else 100?
    I would like the solid to disappear when Null comes over it.
    And because there would be more of these solids, I have to ‘bound’ the position, right?
    OR, what would be the simpliest way to say, when null comes over ‘me’, do this and that?
    Hope it’s clear what I mean 🙂

    Jaka Stucin replied 19 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 2, 2007 at 2:38 pm

    In your first expression, try replacing || with &&. You need an “and” operation there instead of an “or”.

    In general, if you’re only worried about overlap in the x direction, you could do it like this:

    x = thisComp.layer(“Null 5”).transform.position[0];
    if (x > toWorld([0,0])[0] && x < toWorld([width,0])[0]) 0 else 100 Dan

  • Jaka Stucin

    October 3, 2007 at 7:45 am

    Thank you very much, Dan. That’s exactly what I needed.
    I worked on it a little and expanded it to:
    x = thisComp.layer(“Null 5”).transform.position[0];
    y = thisComp.layer(“Null 5”).transform.position[1];
    if (y > toWorld([0,0])[1] && y < toWorld([0,height])[1] && x > toWorld([0,0])[0] && x < toWorld([width,0])[0]) 0 else 100;

    and it’s perfect :)Thanks.
    Just one more, if you’re in the mood. I would like to achieve the effect of ‘mouse over’ like there is on the bottom of this post, where it says: ‘rate this post’ and there are 5 cow-rectangles. I would parent 2 pointers to null (standard and hand pointer), so when null comes over any solid, the standard pointer’s opacity goes 0 and hand pointer’s opacity goes 100. I hope you understand what I mean and that you can help me.
    Thanks a lot, Jakas

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