Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions comparing values of 2 angles == strange results ?

  • comparing values of 2 angles == strange results ?

    Posted by Marticus Kilverticus on March 8, 2019 at 4:16 pm

    Hi all,

    Just found something strange I thought I’d ask if I was missing something.
    I’m comparing 2 angle values, which when the same should trigger the next value.

    qq = (thisComp.layer("layer1").effect("Angle Control")("Angle"))
    ww = (effect("Angle Control")("Angle"))

    if (ww == qq) 1; else 0

    When == is used, it never seems to trigger the correct response even though both values are the same, switching to <= worked for me (luckily my angle will only ever be higher than the other one.
    Anyone know if there’s a reason for this? Am i using == wrong here?

    Thanks

    Dan Ebberts replied 7 years, 1 month ago 3 Members · 5 Replies
  • 5 Replies
  • Kalleheikki Kannisto

    March 8, 2019 at 4:24 pm

    “==” has zero tolerance, so you might want to round the angles to the closest full degree or whatever tolerance is suitable for you needs.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Marticus Kilverticus

    March 11, 2019 at 10:30 am

    I get that, but the angles have been manually set to exactly the same value and I still get the same result…

  • Dan Ebberts

    March 11, 2019 at 2:29 pm

    Try it this way:

    qq = thisComp.layer(“layer1”).effect(“Angle Control”)(“Angle”).value;
    ww = effect(“Angle Control”)(“Angle”).value;

    if (ww == qq) 1; else 0

    Dan

  • Marticus Kilverticus

    March 12, 2019 at 5:27 pm

    Yep, adding .value to the referenced angle did it. Would love to know why!

    Either way, lesson learnt, thanks Dan

  • Dan Ebberts

    March 12, 2019 at 6:07 pm

    When you do this:

    qq = thisComp.layer(“layer1”).effect(“Angle Control”)(“Angle”)

    you have set variable qq to be the Angle Control object. Sometimes you can get away with this and AE will assume you really want the value of that control, but not always. When in doubt, add .value.

    Dan

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