The code below contains a rectangle which can be filled with a percentage and adds up in the rectangular shape according to this sample code from Stack Overflow:
Fill custom SVG image using percentage value
We however need the bucket to be filled with the percentage.
The bucket shape has been drawn using SVG.
The general idea here is that whatever percentage is added, that amount will be filled, in this case, the percentage of water in a bucket:
Code has been adapted for fill="url(#lg)" to be included on the bucket shape in order to have the same functionality as the rectangle but that does not work.
<svg width="500" height="400" xmlns="http://www.w3.org/2000/svg">
<path d="M220,40 L250,250 L390,250 420,40
A50,10 0 0,1 220,40
Q320,10 420,41"
stroke="black" fill="transparent"/>
</svg>