How to create progress bar graphic

Soldato
Joined
17 Jun 2012
Posts
11,259
I have to create a circular progress 'bar', so a coloured circle with the X% in the middle. I can't find a widget/control so looks like I will have to produce 100 of them and load them as needed, 100 because 100% etc.

Can you think of a fast auto way of doing this in say PS instead of painstakingly trying to produce 100 images one after the other.
 
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
If you're not able to do it in css and you need to use different images, do you really need 100? If you're displaying the percentage number anyway, 5% resolution is surely enough for the image? You'd only need 20.

Having said that, there must be a better way than loading lots of different images.
 
Soldato
OP
Joined
17 Jun 2012
Posts
11,259
Well it's for an indicator of progress, say a certain task for 56% complete, a certain page would show this kind of thing.
 
Man of Honour
Joined
13 Oct 2006
Posts
92,038
Do you not have commands to create and write to an image buffer for this? either drawing to the buffer or rotating and copying from another buffer?
 
Man of Honour
Joined
13 Oct 2006
Posts
92,038
Well ofc I can write however I need 100 separate graphics so I can load in when needed.

Don't need loads of separate images if you have image commands - look at a code example for rendering a simple analogue clock just a couple of sin and cos calculations and some sqr for the line length or copy and rotate a source image into a buffer procedurally.
 
Last edited:
Associate
Joined
10 Nov 2013
Posts
1,808
The best way to solve the problem is not with 100 images. Just search for "<app/language> circle progress bar" and I'm sure there will be plenty of other solutions.
 
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
Well ofc I can write however I need 100 separate graphics so I can load in when needed.

I still dont see why you'd need 100 images. 20 images in increments of 5% surely would be enough? Who's going to get their protractor out to see if the image exactly matches with the number overlaid?
 
Man of Honour
Joined
13 Oct 2006
Posts
92,038
I still dont see why you'd need 100 images. 20 images in increments of 5% surely would be enough? Who's going to get their protractor out to see if the image exactly matches with the number overlaid?

Some implementations even only use 10 increments - I'm not a fan of doing it with multiple images anyhow aslong as you have reasonably decent performance graphic commands to read/write buffers and copy/rotate blocks of image data and/or draw 2D primitives it is much better to do it that way than include dozens of images.

If you want to plot a position in a circle around a central point the maths is pretty simple (depending on language, etc. might have to mess about a bit with degrees/radians conversion):

angle=degrees*(pi/180)
x=sin(angle)*linelength
y=cos(angle)*linelength

Then just add x and y to your origin x and y and convert the percentage based on the percentage of 360 degrees for the angle.
 
Last edited:
Back
Top Bottom