- Author:
- Greg Reimer
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- github.com/greim
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/266
- Shortlink:
- https://js1k.com/266
- Blog post:
- please update here!
- Bytes:
- 1014
- Chars:
- 1014
- Submission
(function(l,x,t,n){x.body[n].margin="0";x.body[n].overflow="hidden";var r=self.innerWidth,p=self.innerHeight,b=x.getElementById("c"),e=r/2,y=p/2,c=(t.sqrt(5)+1)/2,g=300,h=[],u=0,a=b.getContext("2d"),q=function(f,m){var d=m==0?t.pow(f,2)/30+100:m==1?t.sqrt(f)*30:m==2?f*3:g-f;return d},o=function(f,m){var d=m==0?t.log(f+2)*3.5:m==1?22-t.log(f+2)*3.5:t.log(t.sin(f/g*t.PI)*40+1)*4+1;return d},v=[[0,0],[1,2],[2,0],[3,1]][new Date().getTime()%4],k="rgba(0,0,0,"+(t.random()>0.5?0.3:0.1)+")";b.width=r;b.height=p;b[n].background="#000";function j(m,w,i,f){a.fillStyle=f;var d=e+t.cos(m*2*t.PI)*w;var s=y+t.sin(m*2*t.PI)*w;a.beginPath();a.arc(d,s,i,0,t.PI*2,true);a.fill()}(function(){u++;h.unshift({a:u*c,c:((u+(g/3))%g)/g});if(h.length>g){h.pop()}a.fillStyle=k;a.fillRect(0,0,r,p);for(var d=0;d<h.length;d++){var f=(1-d/g)*4;j(h[d].a,q(d+1,v[0]),o(d,v[1]),"hsla("+t.round((h[d].c)*360)+",100%,50%,"+f+")")}l.setTimeout(arguments.callee,20)})();ondblclick=function(d){c=(d.pageX-e)/r}})(window,document,Math,"style");
- Description
- PHIreworks! version 1.2 (keep reloading to see variations) (find the easter egg)
- Base64 encoded
KGZ1bmN0aW9uKGwseCx0LG4pe3guYm9keVtuXS5tYXJnaW49IjAiO3guYm9keVtuXS5vdmVyZmxvdz0iaGlkZGVuIjt2YXIgcj1zZWxmLmlubmVyV2lkdGgscD1zZWxmLmlubmVySG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IrZisiKSIpfWwuc2V0VGltZW91dChhcmd1bWVudHMuY2FsbGVlLDIwKX0pKCk7b25kYmxjbGljaz1mdW5jdGlvbihkKXtjPShkLnBhZ2VYLWUpL3J9fSkod2luZG93LGRvY3VtZW50LE1hdGgsInN0eWxlIik7
- Original source
/*
PHIreworks! version 1.2
copyright 2010 by Greg Reimer (http://github.com/greim)
*/
(function(w,d,m,s){
d.body[s].margin = '0';
d.body[s].overflow = 'hidden';
var width = self.innerWidth,
height = self.innerHeight,
canvas = d.getElementById('c'),
midWidth = width / 2,
midHeight = height / 2,
PHI = (m.sqrt(5)+1)/2,
amount = 300,
dots = [],
i = 0,
context = canvas.getContext('2d'),
dist = function(x,i){
var result = i==0 ? m.pow(x,2)/30+100 : i==1 ? m.sqrt(x)*30 : i==2 ? x*3 : amount-x;
return result;
},
size = function(x,i){
var result = i==0 ? m.log(x+2)*3.5 : i==1 ? 22-m.log(x+2)*3.5 : m.log(m.sin(x/amount*m.PI)*40+1)*4+1;
return result;
},
f = [[0,0],[1,2],[2,0],[3,1]][new Date().getTime()%4],
opac = 'rgba(0,0,0,'+(m.random()>.5?.3:.1)+')';
canvas.width = width;
canvas.height = height;
canvas[s].background = "#000";
function placeDot(angle, distance, size, color){
context.fillStyle = color;
var x = midWidth + m.cos(angle*2*m.PI) * distance;
var y = midHeight + m.sin(angle*2*m.PI) * distance;
context.beginPath();
context.arc(x, y, size, 0, m.PI*2, true);
context.fill();
}
(function(){
i++;
dots.unshift({a:i*PHI,c:((i+(amount/3))%amount)/amount});
if (dots.length > amount) { dots.pop(); }
context.fillStyle = opac;
context.fillRect(0,0,width,height);
for (var j=0; j<dots.length; j++){
var trans = (1-j/amount)*4;
placeDot(
dots[j].a,
dist(j+1,f[0]),
size(j,f[1]),
"hsla("+m.round((dots[j].c)*360)+",100%,50%,"+trans+")"
);
}
w.setTimeout(arguments.callee, 20);
})();
ondblclick = function (e) {
PHI = (e.pageX - midWidth) / width;
};
})(window,document,Math,'style');