Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions shape path expression: connect 2 curves

  • shape path expression: connect 2 curves

    Posted by Santi Agustí on September 12, 2018 at 4:02 am

    Hi!
    I was playing with the idea of having a flying piece of paper, via shape layer and some path expressions.
    I’ve this thing done:

    which is, 2 paths with trim paths on each one, and then I created 2 shape paths via expressions, to have a line go from the start trim on curve A to the start trim on curve B, and same with the endings
    Then with a slider called “grow”, making it all flow

    on these shapes, Im using this expression (same on the ending parts changing “start” with “end”)


    var pathDelante =content("delante").content("Path 1").path
    var pathDetras=content("detras").content("Path 1").path

    adelante=content("delante").content("Trim Paths 1").start/100;
    a=(pathDelante.pointOnPath(adelante));
    //

    bdetras=content("detras").content("Trim Paths 1").start/100;
    b=(pathDetras.pointOnPath(bdetras));
    //

    TL=[a[0],a[1]]
    TR=[b[0],b[1]]
    //
    createPath(points = [TL, TR], inTangents = [], outTangents = [], is_closed = false);

    The problem is the gap we see when the curves have their peak, we should have a tangent line connecting the vertex of both curves at that point.

    I will need a new path shape, to create a line to connect these 2 vertex when needed (maybe via checkbox, or even better, making it follow the start or ending trim, but adding some sort of clamp so that line stuck there until the top line or bottom line reaches that point)

    Also, as the curves may vary, I cannot give to the expression a given number of vertex to do that, so it should be calculated on the fly…

    But I have no idea about how to achieve that (or if thats even possible)

    do you have any idea?

    thanks!

    (adding a fill color to that will be a different story)

    Santi Agustí replied 7 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    September 12, 2018 at 1:20 pm

    Based on your description I gather your could do almost the same thing for the “middle” edge as the two others, with the difference that you would control the position of the edge with a static slider value (rather than through math, which I believe would be extremely difficult) and then check if the position value of the middle line is between current start and end trim path values to determine whether it should be drawn or not. The slider approach would also make it possible to change the middle line position to a different location if you have several such “folds” along the way.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Santi Agustí

    September 12, 2018 at 5:07 pm

    thanks!
    I was so focused on guessing how to achieve the math stuff, that I totally lost the non-so-automatic but super handy approach, thanks for pointing at it! 🙂

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