How do i tint an image with HTML5 Canvas ?
Posted
by djdolber
on Stack Overflow
See other posts from Stack Overflow
or by djdolber
Published on 2010-04-22T07:31:34Z
Indexed on
2010/04/22
7:33 UTC
Read the original article
Hit count: 223
My question is, what is the best way to tint an image that is drawn using the drawImage method. The target useage for this is advanced 2d particle-effects (game development) where particles change colors over time etc. I am not asking how to tint the whole canvas, only the current image i am about to draw.
I have concluded that the globalAlpha parameter affects the current image that is drawn.
//works with drawImage()
canvas2d.globalAlpha = 0.5;
But how do i tint each image with an arbitrary color value ? It would be awesome if there was some kind of globalFillStyle or globalColor or that kind of thing...
© Stack Overflow or respective owner