Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Inverting, 0 -> 1 and 1 -> 0

  • Inverting, 0 -> 1 and 1 -> 0

    Posted by Martin Löfqvist on October 10, 2009 at 7:07 pm

    Hello,

    Im trying out some audio responsive graphics. Trying to link the opacity to the bass but is turning out with the reverse result: it’s showing when suppose to not and vice versa.

    So: Is there a way to invert a number? I want 1 to become 0 and 0 to become 1.

    I’m not very good with expression so I just might have missed something obvious!
    Thankful for any help

    Micah Haun replied 16 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 10, 2009 at 9:30 pm

    If you’re trying to invert opacity, just subtract the value from 100.

    In general though, if you want to convert one range of numbers to another, you can use the linear() method. For example, if “x” represents the value you want to convert, for opacity you could use something like this:

    invertedX = linear(x,0,100,100,0);

    Or, as you suggest, you could use it to invert 0 to 1:

    invertedX = linear(x,0,1,1,0)

    It’s pretty versatile.

    Dan

  • Martin Löfqvist

    October 11, 2009 at 12:37 pm

    Thanks!

    Seems to work, two questions though:
    1) How does the linear function work?
    2) Is there a way to render a variable, ie in a text box.

  • Micah Haun

    October 26, 2009 at 7:15 pm

    1. It takes the minimum and maximum value from the source and translates it to min and max values plus everything in between. You can also use ease(), ease_in(), or ease_out() to slow the interpolation down at one or both ends. Linear keeps all proportions the same as the source and scales accordingly.

    2. Go to the text layer’s “Source Text” property, add an expression, and pick whip the value you want.

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