Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Inverting a value between expressions

  • Inverting a value between expressions

    Posted by Mitch Temkin on February 14, 2011 at 1:02 am

    I’m playing with lens flares on a moving image. I have the brightness of one flare connected via expression to the z-position of the image, and want a second lens flare to change in opposition to the first flare, so that as one flare’s brightness value increases the other will decrease.

    Any ideas?

    Thanks!

    Mitch Temkin replied 15 years, 3 months ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    February 14, 2011 at 1:24 am

    since the flare brightness can go up to 300% you probably need to define a maximum value. Play around with this:

    maxValue = 200; // try 100 if this doesn’t seem right
    maxValue – effect(“Lens Flare”)(“Flare Brightness”)

    Dan

  • Mitch Temkin

    February 14, 2011 at 5:37 pm

    Hi Dan –

    Thanks for the reply. I’m still not getting things to work. Probably because I don’t know scripting language for expressions.

    When I pick whip the brightness of the second lens flare to the brightness of the first flare, I get this:

    thisComp.layer(“lensflare03″).effect(” Light Factory EZ”)(“Brightness”)

    I’ve tried appending the code you sent in a variety of ways and can’t seem to get it right.

    Any more help?

    Thanks,

    Mitch

    thisComp.layer("lensflare03").effect(" Light Factory EZ")("Brightness")

  • Dan Ebberts

    February 14, 2011 at 5:45 pm

    Ah, OK – try this:

    maxValue = 100;
    maxValue – thisComp.layer(“lensflare03″).effect(” Light Factory EZ”)(“Brightness”)

    Dan

  • Mitch Temkin

    February 14, 2011 at 5:53 pm

    You are a genius! It works perfectly if I tweak the maxValue to 150.

    Can you explain to me why this creates an inverse value?

    Thanks again!

    Mitch Temkin
    Video & Grfx Production
    864 Almond Drive
    Watsonville, CA 95076
    831-722-9767 [office]
    831-241-2344 [cell]
    juxtaposer@charter.net

  • Dan Ebberts

    February 14, 2011 at 6:04 pm

    The expression just sets the value of the second flare by subtracting the value of the first flare from 150. So when the first flare is 150 the second is zero, when the first flare is 75 the second is 75, etc.

    Dan

  • Mitch Temkin

    February 14, 2011 at 6:16 pm

    Thanks again!

    I wish all my art background had prepared me for a little programming.

    Expressions are great when I can get ’em to work! They’re easy to conceive, but harder to code.

    Mitch Temkin
    Video & Grfx Production
    864 Almond Drive
    Watsonville, CA 95076
    831-722-9767 [office]
    831-241-2344 [cell]
    juxtaposer@charter.net

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