Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Convert Shape Layer object space to Comp Space

  • Convert Shape Layer object space to Comp Space

    Posted by Brady Baltezore on March 21, 2020 at 12:55 pm

    (There’s a very similarly named thread on here from a few years ago, but it seems to convert the info in the opposite direction I’m trying to)

    I have a shape layer with a number of ellipses, the positions of which are being driven by sliders on another null. Great.
    The ellipses are in pairs, each heading in the opposite direction of one another.

    I’m trying to create a line that emerges as each pair separates (connecting the dots essentially) and I’d really like the lines’ end points to be driven by the position of each ellipse.

    I tried creating a layer with a beam effect, and connecting the start and end point to the position of the relevant ellipses.
    However, shape layer space and comp space are separate, and toComp doesn’t seem to work within a shape layer?

    Any help appreciated!

    B

    Brady Baltezore replied 6 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    March 24, 2020 at 10:14 am

    I don’t think you need that information to create the links.
    I suggest you create a Path and add this expression to it. That way, you can have all the benefits from shapes(stroke width, color, dots, linecap etc)
    You can even create it in the same layer with the ellipses. If you create the Path in the same layer, add this expression to it:


    pos1 = content("Ellipse 1").transform.position;
    pos2 = content("Ellipse 2").transform.position;
    dots = [pos1,pos2];
    createPath(dots)

    If you want a different layer, make sure both have the same position(you can link the position of this second layer to the one with the ellipses) and add this expression to your Path:

    L=thisComp.layer("Ellipses");
    pos1 = L.content("Ellipse 1").transform.position;
    pos2 = L.content("Ellipse 2").transform.position;
    dots = [pos1,pos2];
    createPath(dots)

    Andrei
    My Envato portfolio.

  • Brady Baltezore

    March 24, 2020 at 1:44 pm

    Andrei,

    Thank you so much! I was not aware that you could use expressions to create paths, so thank you – this worked perfectly. I had actually built it with the two dot colors each on their own separate layers, but it was easy enough to create a new layer for the lines and write:

    pos1 = thisComp.layer(“DOTS_layer01”).content(“DOT_01”).content(“DOT 1”).position;
    pos2 = thisComp.layer(“DOTS_layer02”).content(“DOT_01”).content(“DOT 1”).position;
    dots = [pos1,pos2];
    createPath(dots)

    Appreciate your suggestion, problem solved. Still curious about the original way, for future purposes

    Thanks again,
    Brady

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