Merge pull request #28 from DanielRapp/master

Added Noisy
This commit is contained in:
Ryan Kirkman
2011-05-11 04:23:28 -07:00
2 changed files with 28 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
(function(c){c.fn.noisy=function(b){b=c.extend({},c.fn.noisy.defaults,b);var d,a;if(JSON&&localStorage.getItem)a=localStorage.getItem(JSON.stringify(b));if(a)d=a;else{a=document.createElement("canvas");if(a.getContext){a.width=a.height=b.size;for(var h=a.getContext("2d"),e=h.createImageData(a.width,a.height),i=b.intensity*Math.pow(b.size,2),j=255*b.opacity;i--;){var f=(~~(Math.random()*a.width)+~~(Math.random()*a.height)*e.width)*4,g=i%255;e.data[f]=g;e.data[f+1]=b.monochrome?g:~~(Math.random()*255);
e.data[f+2]=b.monochrome?g:~~(Math.random()*255);e.data[f+3]=~~(Math.random()*j)}h.putImageData(e,0,0);d=a.toDataURL("image/png");if(d.indexOf("data:image/png")!=0||c.browser.msie&&c.browser.version.substr(0,1)<9&&d.length>32768)d=b.fallback}else d=b.fallback;JSON&&localStorage&&localStorage.setItem(JSON.stringify(b),d)}return this.each(function(){c(this).css("background-image","url('"+d+"'),"+c(this).css("background-image"))})};c.fn.noisy.defaults={intensity:0.9,size:200,opacity:0.08,fallback:"",
monochrome:false}})(jQuery);
+25
View File
@@ -0,0 +1,25 @@
{
"name": "noisy",
"filename": "jquery.noisy.min.js",
"version": "1.0",
"description": "Adds random noise to the background of a given element.",
"homepage": "http://rappdaniel.com/noisy/",
"keywords": [
"noisy",
"noise generator",
"canvas"
],
"maintainers": [
{
"name": "Daniel Rapp",
"email": "danielrappt@gmail.com",
"web": "http://rappdaniel.com/"
}
],
"repositories": [
{
"type": "git",
"url": "https://github.com/DanielRapp/Noisy"
}
]
}