Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using a slider control to loop shapes along path

  • Using a slider control to loop shapes along path

    Posted by Elliot King on April 24, 2021 at 7:06 am

    Hi there,

    I am trying to loop a series of strokes and shape layers along a path using the trim paths offset and a slider control.

    This is fine when I am only using strokes, as I can link the offset of the stroke’s trim path to a slider control using the following expression, therefore enabling me to have control of the loop for multiple strokes at once:

    thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”)-value

    However I’m running into problems if I want to introduce shapes layers to the same loop. Normally when I’m not concerned about a loop, I’d just use Create Nulls From Paths (trace null) and parents a shape layer to the null. This obviously doesn’t work with a loop because the null is only linked to the start or end of the trim path, not the offset.

    I have attached a picture as reference. As you can see, each line includes some strokes, and some shape layers, all which need to loop as an offset.

    Does anyone have a good work around for this?

    Thanks in advance.

    Filip Vandueren replied 5 years, 3 months ago 2 Members · 5 Replies
  • 5 Replies
  • Filip Vandueren

    April 24, 2021 at 1:34 pm

    a Modulo % operator on the positionOnPath() should do the trick, but it will cause objects to suddenly disappear/appear from one end to the next.

    Does it have to be a vector-based result, or can you get away by using MotionTile or the Distort > Offset Effect ?

  • Elliot King

    April 25, 2021 at 9:26 am

    I’m trying to avoid the sudden disappearing/reappearing, so basically functioning in the same way as the trim paths offset. However this does seem like a good solution! Can I ask how I would go about achieving this? (Apologies as I am new to using expressions!).

    I did find this query (https://creativecow.net/forums/thread/find-the-postition-of-the-end-point-of-a-trim-path/) that Dan replied to but I’m not sure where to apply the expression to make it work!

    Find the postition of the End Point of a Trim Path

  • Filip Vandueren

    April 26, 2021 at 11:05 am

    The only way to avoid the reappearing and disappearing would be to either have two copies of every shape (so that a triangle can be ‘cut’ in two when it approaches the edges) and a lot more complicated code, or to have the lines extend beyond the sides of the composition so the sudden switch from one side to the other is masked off…

    More things to think about: to have shapes align exactly with dashes, all the dashes and gaps have to add up exactly to the total length of your line (or be a perfect fraction of the lines length)

    Attached is my version of having the position of a shapelayer be tied to the dash-offset, (still with sudden shift) it was a bit more complicated than I first thought because the dash offset is in absolute numbers, not in a 0-360° Phase like Trim Paths.

    But also, like I mentioned in my previous post: the simplest solution is just to add a motion tile

  • Elliot King

    April 27, 2021 at 8:46 am

    Ah I see. Thank you very much Filip. This is very interesting!

    You’re using the dashOffset expression to control the animation – is there a simple swap out for the Trim Paths offset so I can control multiple different strokes instead of using one stroke with dashes?

    Thank you

  • Filip Vandueren

    April 27, 2021 at 11:38 am

    That would actually be easier to sync (as it wouldn’t have to take in account the absolute lenght of the path), but animating the Trim Paths of a dashed line tends to yield unexpected results, especially for open paths…

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