JS1K

#2: the original

Source for demo by Mark de Jong.

a=c=d=0,q=640,r=400,f=document;s="getImageData";t="putImageData";u="fillRect";v="fillStyle";x="getContext";y="globalCompositeOperation";g=f.getElementById("c");g.width=q;g.height=r;h=g.cloneNode(false),i=h[x]("2d");h.width=4E3;i[u](0,0,4E3,r);j(i,q,0,q,3);i[t](i[s](0,0,q,3),q,0);i.font="37px Arial";i[y]="xor";i.fillText("An JS1K entry by Spellcoder based on oldskool (early 90's) Amiga cracktros. Greets to all sceners! Bye bye now!",q,30);k=g[x]("2d");g.style.cssText="position:absolute";l=g.cloneNode(false);j(l[x]("2d"),0,r,q,r);function j(e,b,o,p,q){b=e.createLinearGradient(0,0,b,o);b.a=b.addColorStop;b.a(0,"#f00");b.a(.3,"#ff0");b.a(.7,"#08f");b.a(1,"#f00");e[v]=b;e[u](0,0,p,q)}f.body.insertBefore(l,g);for(m=[],n=r;n--;)m[n]=Math.random()*q; (function e(){z=c;k[v]="#000";k[u](0,0,q,r);k[v]="#AAA";for(x=q;x-=2;){z+=.01;k[t](i[s](a+x,3,2,34),x,Math.sin(z)*140+190);if(x<r){m[x]+=m[x]<0?q:-x%8;k[u](m[x],x,2,1)}}k[t](i[s](d,0,q,3),0,0);k[t](i[s](q-d,0,q,3),0,397);d=(d+16)%q;c+=.1;a=(a+4)%2500;setTimeout(e,40)})()