Home > Mobile >  How to make a bar that depletes from both sides in Javascript?
How to make a bar that depletes from both sides in Javascript?

Time:01-03

So I wanted to make a bar that depletes overtime, and I tried googling it, and I found this smooth looking example, but the thing is, I want the bar to deplete from both sides, so it ends up finishing in the middle. How can I do this?

CodePudding user response:

The only thing you need to change in their example is transform-origin: left center; to transform-origin: center;.

Example: https://codepen.io/Bat_Cave/pen/eYjzKpr

More on transform-origin

  • Related