You can only do this in JS by using a canvas.
So one easy thing to do is to use one of the JS canvas libraries.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.