Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions create a path with expressions and use methods like pointOnPath

  • create a path with expressions and use methods like pointOnPath

    Posted by Arne Münch on June 17, 2020 at 2:01 am

    Hi forum
    How can I create a path with expressions and use methods like pointOnPath etc. later within the same expression?
    For example this expression on the source of a textlayer doesnt output [0,0] as expected. It outputs the middlepoint of the original path.

    originalPath = thisComp.layer(“Pathlayer”).content(“Form 1”).content(“Path 1”).path
    correctedPath = originalPath;
    correctedPath.createPath([[-100,0] , [100,0]] , [] , [] , originalPath.isClosed());
    correctedPath.pointOnPath(.5,time);

    Any ideas?
    Thanks so much.

    https://www.instagram.com/arnemuench/

    Arne Münch replied 5 years, 10 months ago 3 Members · 6 Replies
  • 6 Replies
  • Robert Müller

    June 17, 2020 at 10:07 am

    Hi Arne,
    As far as I know you can only create paths on a path object, like in a shape layer or on a mask. And since the expression can only effect the property it’s applied to, the path stays the same

  • Arne Münch

    June 17, 2020 at 5:17 pm

    Hi Robert
    thanks for your reply.
    but i dont really get it. Even when you try to use it in the path expression (what I want, the text layer was only for print out the variable) it doesn´t work. Type this in the path property:
    originalPath = thisProperty;
    correctedPath = originalPath;
    correctedPath.createPath([[-100,0] , [100,0]] , [] , [] , originalPath.isClosed());
    midpoint = correctedPath.pointOnPath(.5,time);

    createPath([ midpoint , [100,0]] , [] , [] , originalPath.isClosed());

    And you would expect the first vertex at [0,0] but it isn´t, it is in middle of what ever the originalPath was.
    How can I create a path and use its attributes afterwards in the same expression?

    https://www.instagram.com/arnemuench/

  • Robert Müller

    June 18, 2020 at 9:07 am

    Okay it seems like the pointOnPath expression needs a drawn path to calculate. But since you are using expressions to draw your path there should be other ways to calculate the mid point.

  • Arne Münch

    June 21, 2020 at 10:11 pm

    hi again
    i actually found another solution for my expression, but the question is still interesting. i don‘t think its easily possible to calculate the point at a given percentage on a path without using pointOnPath. if it is possible at all, i guess its quite complicated beziercurve calculations.

    so i just want to be sure.
    does nobody know if there is a method for creating a path with expressions and using methods like pointOnPath and normalsOnPath afterwards within the same expressions??

    seems strange for that this shouldn‘t be doable.
    thanks for any hints..

    https://www.instagram.com/arnemuench/

  • Filip Vandueren

    June 22, 2020 at 6:21 am

    Not necessarily so strange:
    The path you create in JavaScript is actually just an object that contains only the instructions a different piece of the AE-codeset needs to draw that bezier.
    Similarly, using pointOnPath is probably querying the bezier-drawing part of AE to calculate the result. So I think the bezier-Math isn’t actually accessible directly within the expression.
    Hope I’m making sense, and just speculating though.

  • Arne Münch

    June 22, 2020 at 7:40 am

    thank you Filip
    Yes,makes sense.
    Always good to hear if something is not possible to let go the ideas and stop thinking that I just missed something.

    https://www.instagram.com/arnemuench/

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