Skip to content

Instantly share code, notes, and snippets.

@binarymax
Created April 29, 2015 18:10
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 binarymax/00f568b62b128d822f5b to your computer and use it in GitHub Desktop.
Save binarymax/00f568b62b128d822f5b to your computer and use it in GitHub Desktop.
Solution to The ListServe puzzle
((function(f){"use strict";var bdy=window.top.document.body;bdy.innerHTML="";bdy.style.backgroundRepeat="repeat";var c=document.createElement("canvas");var d=c.getContext('2d');var e="";c.width=f;c.height=f;var g=d.createImageData(f,f);var h=[f*f];var i=[];var j=function(z){var a=g.data;for(var x=0;x<f;x++){for(var y=0;y<f;y++){var b=(x+y*f)*4;a[b+0]=(h[b].r*z)%255;a[b+1]=(h[b].g*z)%255;a[b+2]=(h[b].b*z)%255;a[b+3]=255}}d.putImageData(g,0,0);e=c.toDataURL();i.push('url('+e+')')};var k=0,dir=1;var l=function(){bdy.style.backgroundImage=i[k];k+=dir;if(k===f)dir=-1;if(k===0)dir=1};for(var x=0;x<f;x++){for(var y=0;y<f;y++){var m=(x+y*f)*4;h[m]={r:parseInt((x^y)),g:parseInt((x|y)),b:parseInt((x&y))}}}for(var z=0;z<f;z++){j(z)}setInterval(l,200)})(300))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment