I suggest putting another bar over it and moving it left / right as needed.
If the stripes should not stretch the length of the viewport, you can put them in a div with overflow: hidden to keep the illusion intact.
Edit:
I just realized why I wanted to do it this way, and not follow what you started. When I did something similar before, he used images where the change in width, of course, distorted the overlay image.
With simple colors, I'm sure you could get away just by using size. But I still use CSS to align one over the other.
source share