Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects get X Y of layer in comparison of composition

  • get X Y of layer in comparison of composition

    Posted by Atul Rajput on August 3, 2018 at 5:35 am

    I have a composition of size 1280*720
    and a layer of 150*75
    I want to get the starting point of this layer in the composition in %,
    For example:-
    If the layer starts from the very beginning of composition then the x y should be 0% 0%.
    if the layer starts at 640 and 360 then the X and Y should be 50% 50%;

    Please help me out.

    Kalleheikki Kannisto replied 7 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kalleheikki Kannisto

    August 3, 2018 at 7:52 am

    This is the layer’s position in percentage values, output to a text layer’s source text:

    L = thisComp.layer("My Layer");
    x_per = L.transform.position[0]/thisComp.width;
    y_per = L.transform.position[1]/thisComp.height;
    x_per + "%, " + y_per + "%"

    Kalleheikki Kannisto
    Senior Graphic Designer

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