Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Return positive values only

  • Return positive values only

    Posted by Alejandro Benavente on September 9, 2009 at 11:28 am

    Hi there.

    I have an expression-driven scale property for a layer. Now, my expression returns positive and negative values; I’d like to discard the lattest, so that positive values are used, yet negative ones are discarded as 0.

    I’ve found a lot of answers that use the Math.abs expression, yet this wouldn’t work for me, as negatives would turn positive with the same absolute, not 0, which is what I need.

    I think the solution must be really simple; sorry if this has been answered before, I’ve done some search without success.
    Thanks a lot.
    A.

    Alejandro Benavente replied 16 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 9, 2009 at 12:44 pm

    Separate your scale vaule into x and y components and then use something like this:

    [Math.max(x,0), Math.max(y,0)]

    Dan

  • Alejandro Benavente

    September 14, 2009 at 9:20 am

    Hi, Dan.
    I succedeed with a different approach before reading your hint.
    I’ll give it a try, though, to check if it works.
    Thanks!
    A.

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