Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Define range of position coordinates

  • Define range of position coordinates

    Posted by Terje Lundgren on October 4, 2007 at 9:41 am

    I want to create an expression that limits the position values of a layer to a defined range of coordinates.

    The range of both x and y should be 0-200.

    x = value[0] ;
    y = value[1] ;

    if (x > 0){
    [x, y];}
    else{ [0,y];}
    // Locks x as expected on the left

    if (x < 200){ [x, y];} else{ [200 , y ];} // When this line is added the layer is locked on the right, but the previous if-statement is ignored. Additional code for the y values is needed. Any help appreciated.

    Dan Ebberts replied 18 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    October 4, 2007 at 12:16 pm

    One way:

    x = clamp(value[0],0,200);
    y = clamp(value[1],0,200);
    [x,y]

    Dan

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