npm install cordova
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the canvas and the context | |
var c = document.querySelector('canvas'); | |
var cx = c.getContext('2d'); | |
// pixelcolour returns an object of rgba for the pixel at x and y | |
// great for checking if you are in a certain boundary or for | |
// colourpickers | |
function pixelcolour(x, y) { | |
var pixels = cx.getImageData(0, 0, c.width, c.height); | |
var index = ((y * (pixels.width * 4)) + (x * 4)); |