A port of https://github.com/castorflex/SmoothProgressBar