Your ImageRectSize is equal to the size of the image (in pixels, not the size in the studio, the size in the drawing program used to make it. For this example, let’s use 500 by 500 as the image size). ImageRectOffset would be calculated by using the Y pixel size (in this case, it’s 500) divided by the percent change in size from the original size:
Here I have an image that has an exact pixel size of 420 by 420, with the frame size being 100 by 100. This means that the ImageRectSize is 420, 420. I will run this code for the dynamic change:
For example, the curve (in the viewport at least, again, you’ll need the size of the actual image), is 125 x 426. To fill half of the progress bar, you will take the Y size (426 pixels) and multiply it by the percentage of health.
I tried putting the offset to the size of the viewport, but it just dissapears like this:
Couple of things here. ImageRectSize should be holding {154, 573} in the approach they have outlined, you then use offset to realign the image.
A simpler alternative approach is ScaleType Crop and Size (Scale - in your case Udim2.fromScale(1, fractionHere))
Use a UIGradient object. Rotate it 90 degrees, create a harsh transparency gradient, and set the offset in your script according to your health. Tweak the gradient if needed.