ProgressBar - Segmented Progress Bar Gradient & Image

Set up a progress bar divided into multiple segments, each with customizable height and margin, and set the color & image for the progress.


Functions Version 1.0

  1. InitializeSegmentedProgressBar
    • Description: Initializes a segmented progress bar.
    • Parameters:
      • id (int): Unique identifier for the segmented progress bar.
      • arrangement (HorizontalArrangement): Container to which the progress bar will be added.
      • segments (int): Number of segments in the progress bar.
      • progressColor (String): Color of the progress in hexadecimal format (e.g., "#FF0000").

  1. SetSegmentHeight
    • Description: Changes the height of the segments in the progress bar.
    • Parameters:
      • id (int): Unique identifier for the segmented progress bar.
      • segmentHeight (int): Height of the segments in pixels.

  1. SetSegmentMargin
    • Description: Changes the margin between segments in the progress bar.
    • Parameters:
      • id (int): Unique identifier for the segmented progress bar.
      • segmentMargin (int): Margin between segments in pixels.

  1. SetTotalProgress
    • Description: Sets the total progress of the segmented progress bar.
    • Parameters:
      • id (int): Unique identifier for the segmented progress bar.
      • progress (int): Total progress in percentage (0 to 100).

  1. GetTotalProgress
    • Description: Gets the total progress of the segmented progress bar.
    • Parameters:
      • id (int): Unique identifier for the segmented progress bar.
    • Return Value: Total progress in percentage (0 to 100) or -1 if the ID is not found.

  1. ResetTotalProgress
    • Description: Resets the total progress to 0 in the segmented progress bar.
    • Parameters:
      • id (int): Unique identifier for the segmented progress bar.

Event

  • TotalProgressComplete
    • Description: Triggered when the total progress of the segmented progress bar reaches 100%.
    • Parameter:
      • id (int): Unique identifier for the segmented progress bar that has completed the progress.

screenshots

Maybe it can work for audio, but you need an audio sensor.
1721739701464

Example video:


Update, version 1.1

Now, when calling the Initialize Segmented Progress Bar function, you can pass a list of colors in hexadecimal format and the segmented progress bar will be initialized with these colors.

You can also put a gradient, but it only works well if it's a single segment, true to apply the gradient.

I've added functionality to set segment corners as straight or rounded. The shape of the segments is set by the shapeType parameter in the InitializeSegmentedProgressBar function. If shapeType is "rectShape", the corners will be straight; otherwise, they will be rounded.

I have added the SetSegmentColor function to change the color of a list of segments in the progress bar. This function takes the id of the progress bar, a list of the indexes of the segments you want to change, and the new color in hexadecimal format.

screenshots


1721894642962

Update, version 1.2

You can set radius to the bar segments
(Does not apply to the 1-segment bar).


Set an image as progress in the selected index.
You can select the image from gallery or the best option, upload it to the app assets and select it from there.

screenshots

1722241990305 1722241990297

Update Version 1.3

The SetSegmentColor function now accepts a list of colors and applies a gradient if useGradient is set to true.

screenshots

1722420059890

Extension:

Version 1.0
JoeDevProgressBar.aix (10.0 KB)
Version 1.1
JoeDevProgressBar.aix (11.7 KB)
Version 1.2
JoeDevProgressBar.aix (13.8 KB)
Version 1.3
JoeDevProgressBar.aix (14.2 KB)


Thanks.

8 Likes

Thanks for your contribution.

Thank you so much @husnain

Thanks for sharing this extension, I'm going to try it!

Thank you very much @Gabriel_Egea , I have some extra features for the next update, I hope you like this extension, any questions, let me know.

Update
Version 1.1

1721894642962

1 Like

Very good :+1:

Can it be done with a background image? See here

1 Like

Thank you so much @TIMAI2
I don't know how to do it yet, but I'll look into it.

Update...

3 Likes

Great update, thanks a lot for this extension. It's great.

1 Like

image
Do you think it is also possible to configure a gradient in the block that configures the .SetSegmentColor? Thanks again

1 Like

Thank you so much @Gabriel_Egea

I think so, as soon as I have that done I will upload the update.

1 Like

Update
Version 1.3

@Gabriel_Egea

1 Like

Wow super fast, thanks a lot for this change!

1 Like

I was trying the extension there and it seems that there is an error, the segmentIndex value stopped accepting the lists, it would not let me make a list with the segments. Is this the case now? Should I make a block for each segment? Thanks

It's true, it's a single index, in a few more hours I will solve that detail, I was doing tests and I missed it.

1 Like

Thank you very much, it is not a serious problem because you can use one block for each segment, it is more uncomfortable but it could be used that way. Thanks again for your work.

@Gabriel_Egea

I have updated the Version 1.3 extension so that the SetSegmentColor function accepts a list of indices.

2 Likes

@Joejsanz, again thank you very much

1 Like

@Joejsanz Query, how are you getting the gradient to pass through the segments? 1722420059890

In my case, the gradients are generated within the segment individually. What configuration should I use for the gradient to be generated as in the attached gif?

image

This is how my gradient looks with the following configuration

But if you look at the gradient it is generated in each segment individually