Search the Community
Showing results for tags 'pure'.
How to make click Pixelperfect on Canvas DEMO + Tutorial https://leoche.github.io/Pixelperfect-Click-Canvas/ Summary There is no easy way to draw something and capture a pixel perfect click on it with HTML5 canvas. But there is a trick! We can attribute a random color to each Sprite we create then on a new blank buffer canvas, draw all sprites but only with their respective colors. Capture mouse input coordonates on real canvas then look the color of the pixel on the buffer canvas then compare this color with your sprites. If colors matches you clicked on this sprite!