Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Jason Yardley on November 4, 2015 at 5:32 pm

    Hi I need some help to make up an expression, I need to make up an expression that when I move a object it will add a value to a plug in, here is the example I have a radar dot on screen i what to move the dot position upwards and when I move the position upwards I want the value of a Plug in called numbers to increase the Numbers up as well but I only want the value of the numbers to go between certain numbers which will be 0.0 to 10.0 can anybody help! I understand I need a Clamp expression on the numbers but I don’t know how write it.

    Jason Yardley replied 10 years, 6 months ago 2 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    November 4, 2015 at 6:16 pm

    What’s the relationship between the position and the number value? I mean, is there a position that corresponds to 0.0 and another that corresponds to 10.0 or are you after something else?

    Dan

  • Jason Yardley

    November 4, 2015 at 6:32 pm

    Yes there is the 0value is on the y position is 270

  • Dan Ebberts

    November 4, 2015 at 6:38 pm

    What corresponds to the 10.0 value?

  • Jason Yardley

    November 4, 2015 at 6:47 pm

    value 10 would equal 165 which is going down so I would need the numbers to go up

  • Dan Ebberts

    November 4, 2015 at 6:51 pm

    Like this then:

    minY = 165;
    maxY = 270;
    y = thisComp.layer(“Radar Dot”).transform.position[1];
    linear(y,minY,maxY,10,0);

    Dan

  • Jason Yardley

    November 4, 2015 at 7:55 pm

    worked a treat! but now I need to position the radar dot in the middle which is y position 270 and now I need to move the dot down to position 394 and have the numbers move between 0 and 10 again

    So the Radar dot moves between 270 middle to 165 top and the numbers go from 0 to 10 then (which you gave me the expression to many thanks)
    and then move the Radar Dot from 270 middle to 394 bottom and the numbers again go from 0 to 10 again

  • Dan Ebberts

    November 4, 2015 at 9:17 pm

    Like this maybe:


    minY = 165;
    midY = 270;
    maxY = 394
    y = thisComp.layer("Radar Dot").transform.position[1];
    if ( y > 270)
    linear(y,midY,maxY,0,10)
    else
    linear(y,minY,midY,10,0);

    Dan

  • Jason Yardley

    November 5, 2015 at 9:51 am

    Thank you worked great

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