4

I want to animate the drawing of the lines in this graph from left to right so that they are all at the same x-position at the same time. This is a graph I made in MATLAB, exported as an SVG, opened in Illustrator to separate layers, then imported it into AE where I "created shapes from vector layers".

Graph I want to animate

Using a rectangular mask to "draw in" the lines makes the tips not square (I want them to be square). Using "trim paths" with End set to 0% at the first frame and 100% at the last with linear interpolation results in the line tips having different x-values at a given time in the animation since each path is a different length.

Using Trim Paths results in visually uneven "growth" of the lines

Any suggestions?

I have the raw data for these, is there a way to explicitly set keyframes using expressions? Then I could just calculate myself what percent drawn each line should be at each of my x-values, and let AE interpolate those.

I feel like there should be a more elegant way, though, that doesn't involve the raw data.

2
  • 2
    Separate elements to layer and do a vipe from left to right?
    – joojaa
    Oct 19, 2016 at 4:18
  • Since the wipe simply cuts the elements off with a vertical edge, it has the same effect as the reveal mask: line tips are noticeably triangular and pointy, particularly in steep portions of the curve, rather than square and natural.
    – JinjerJohn
    Oct 20, 2016 at 19:25

1 Answer 1

1

I think that Trim Paths is the right approach if you set guides and keyframe each element to hit the guide at the same time.

  1. Start with one layer for each element. For convenience sake I used shape layers with an empty fill and 3PX stroke in different colors, but this should work with an imported illustrator graphic so long as elements are in separate layers.
  2. Set vertical guides along the 20,40,etc. values. and Lock guides
  3. Trim Paths for each layer as you did, 0% at start and 100% at end.
  4. Choose one line and scroll through the timeline until the line is level with a guide. Add a keyframe. Repeat the process until you have a keyframe for each vertical guide.
  5. Lock that layer. That will be a guide for the others to match.
  6. Go to next layer/element and repeat the process where the line crosses each guide.
  7. Adjust the guide layer so its Trim Paths keyframes are visible. For each of the other elements, shift-drag the keyframes so they line up with the guide layer's keyframes.
  8. At this point all the lines should reach each guide at the same time

There's probably a more elegant way to do this with scripting or time remapping, but this way doesn't take long and your ends stay square.

timeline showing keyframed elements

view window example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.