Skip to content

Instantly share code, notes, and snippets.

@loktar00
Created June 7, 2012 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loktar00/2885780 to your computer and use it in GitHub Desktop.
Save loktar00/2885780 to your computer and use it in GitHub Desktop.
metaball part 3
function metabalize(){
var imageData = tempCtx.getImageData(0,0,width,height),
pix = imageData.data;
for (var i = 0, n = pix.length; i <n; i += 4) {
// Checks threshold
if(pix[i+3]<threshold){
pix[i+3]=0;
}
}
ctx.putImageData(imageData, 0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment