So you can pixelate an image by drawing it on canvas like this:
/* css */
.pixelate {
image-rendering: optimizeSpeed;
image-rendering: -moz-crisp-edges;
image-rendering: -o-crisp-edges;
image-rendering: -webkit-crisp-edges;
image-rendering: crisp-edges;
image-rendering: -webkit-optimize-contrast;
image-rendering: pixelated;
-ms-interpolation-mode: nearest-neighbor;
}
// js
var canvas = document.createElement('canvas')
var context = canvas.getContext('2d')
context.webkitImageSmoothingEnabled = false
context.mozImageSmoothingEnabled = false
context.msImageSmoothingEnabled = false
context.imageSmoothingEnabled = false
I'm wondering if there is a way to then figure out where the squares are in the canvas, and what colors they are, so that you can do things with them like (in this case) animate them so it looks like they are sparkling, or perhaps simpler just to animate them back and forth like a wave.