Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Progress bar with constant stroke width

New Here ,
Nov 02, 2018 Nov 02, 2018

Hi,

I am running Adobe After Effects CC 2019 on a Windows machine.

I'm trying to make a progress bar with a pointer showing the current value as the progress bar scales up. Importantly, I am trying to keep a constant stroke width on the progress bar. To avoid the stroke width scaling, I am resizing the bar instead of scaling it. The pointer is linked to a null object which is tracking the progress bar.

Here is the start keyframe:

Here is the end keyframe:

It works okay, but if you look closely, you'll see that the null object is moving slightly faster than the progress bar resizing. You can see the left side of the null object is further away from the stroke in the first image compared to the second image.

Below is a screenshot of the expressions. I am using the slider control from the null object to create a proportional resizing of the progress bar. In my mind, this should ensure that both move at the same pace, but they do not.

Could anyone help explain why this is happening?

Any further information needed, please let me know.

1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 02, 2018 Nov 02, 2018

Would this be easier with trace path as in this video?

How To Create Animated Arrows In After Effects - YouTube

Or even simpler with an animated solid as a mask?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 02, 2018 Nov 02, 2018

I watched the video and tried to replicate with a rectangle. You can't trace the path, unless the rectangle is a bezier shape. If it's a bezier shape, you can't resize it, you can only scale it. That would mean the stroke width would no longer be constant.

I am not sure what you mean by using an animated solid as a mask. Perhaps you could elaborate?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Nov 02, 2018 Nov 02, 2018

Use a layer style stroke instead of the shape's stroke.  That will solve the variable width problem.

I can't tell you why the null is off slightly.  I would guess it's somehow related to the math in your expression.

If I were you I would simply create a two point shape using the pen tool with a stroke.  That will be your bar.

Then apply a Layer Style stroke to the  Shape stroke.  That Layer Style's stroke width will remain constant.

Then animate shape's stroke using a trim paths operator.

Copy the shapes path information to the position attribute of your pointer and...there you go.

~Gutterfish
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 03, 2018 Nov 03, 2018

I agree completely. This is a far easier solution that what the OP is using and also far less tedious.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2018 Nov 04, 2018

Hi both,

Thanks for your responses. I can follow along and animate the progress bar with the layer style stroke. However, I run into trouble at the last part "Copy the shapes path information to the position attribute of your pointer". I tried copying to the Position below (1) highlighted in red. This moves the Bubble Pointer below the progress bar (2) and creates two keyframes on the Position whereby the pointer moves slightly to the right over time. It does not respond to any change in the Trim Path.

Could you please explain the last instruction with a little more detail? I'm probably doing something wrong.

1.

2.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 04, 2018 Nov 04, 2018

I think you are making this much too complicated. I would do the entire bar using one Shape Layer and add a Text layer that was parented to the bar.

Step 1 Create a progress bar shape layer

  1. Draw a rectangle with a fill and stroke anywhere in the Comp Panel, press UU to reveal all modified properties, unlock the Rectangle Path 1 size constraint, set the Y height, zero out Rectangle 1 Transform Position property an
  2. Add a Slider Control to the Shape Layer and name it Progress
  3. Add this expression to Rectangle 1>Rectangle Path>Size:
    [effect("Progress")("Slider"), value[1]]
  4. Add this expression to Transform Rectangle 1>Anchor Point:
    [-content("Rectangle 1").content("Rectangle Path 1").size[0]/2, 0]
  5. Add a shape to the progress bar for the bubble, don't worry about the position now
  6. Press the U key twice again to reveal the bubble shape's transform properties and zero them out so the shape is at layer center
  7. Add this expression to your bubble's Transform Shape>Anchor Point property (in my example I used a polystar):
    [- content("Rectangle 1").content("Rectangle Path 1").size[0], value[1]]
  8. Adjust the Transform Shape> Position property to center the point over the top right corner of the Rectangle
  9. Animate the Progress slider to make the bar grow and the bubble will follow
  10. Add an empty text layer
  11. Press UU to reveal all modified properties
  12. Add this expression to Source Text:
    Math.round(thisComp.layer("Progress Bar").effect("Progress")("Slider") / 22.222)
  13. Add this expression to the text layer's position property
    [value[0] + thisComp.layer("Progress Bar").content("Rectangle 1").content("Rectangle Path 1").size[0], value[1]]
  14. Move the text layer into position
  15. Parent the text layer to the Progress Bar layer
  16. Move the Progress bar layer into position

Here's a screenshot. Very simple, completely editable, and the whole thing can be saved as an animation preset. If you want to use multiple shapes to create the bubble you can add a Merge Paths just above the Rectangle layer set to add. To get the counter to represent the right number of days just do a little division. Divide the bar's maximum length by the maximum value. The expression I posted is for a bar that is 1000 pixels long.

Here's an animation preset that creates a progress bar: Dropbox - Progress Bar.ffx I've been using it for years. Just run it with no layers selected and you'll get this without the text layer.

Screenshot_2018-11-04 11.14.58_EuGGGK.png

If you need motion blur then it will work for the text layer but you'll need to add CC force Motion Blur to the Shape Layer:

Screenshot_2018-11-04 11.25.06_ilA3LV.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 05, 2018 Nov 05, 2018
LATEST

Thank you, Rick. I am just learning and following along with tutorials, that's how I ended up with the solution I had.

I managed to implement your solution and it is working correctly. I will read up on expressions a bit more, so I can fully understand it.

I just wish I could figure out what was wrong with my original expressions.

Thanks again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines