- Author:
- Michal Hantl
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- twitter.com/michal_hantl
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/155
- Shortlink:
- https://js1k.com/155
- Blog post:
- please update here!
- Bytes:
- 979
- Chars:
- 979
- Submission
with(document.body.style){padding=margin=0;overflow="hidden"}c=document.getElementById("c");w=c.width=this.innerWidth;h=c.height=this.innerHeight;var g=c.getContext("2d");l=[];function r(b){return Math.random()*b-b/2}for(var i=0;i++<999;){cw=r(w);ch=r(h);l.push([cw,ch,cw+r(20),ch+r(20),cw+r(99),ch+r(99)])}colors=[0,255,0];t=1;
rd=function(){g.fillStyle="#000";g.fillRect(0,0,w,h);g.strokeStyle="#aa0";g.lineWidth=1;i=5;if(colors[t]>i-1){colors[t]-=i;colors[(t+1)%3]+=i}else turn=(t+1)%3;ss="rgba("+colors.join(",")+",";g.translate(w/2,h/2);for(i in l){m=l[i];dx=x-m[0];dy=y-m[1];d=Math.sqrt(dx*dx+dy*dy);a=75/d;a=a>0.75?0.75:a;if(!(a<0.15)){g.strokeStyle=ss+a+")";if(a>0.6&&r(4)<-1.9)m[6]=1;if(m[6]>0){m[6]-=0.05;g.strokeStyle="rgba(255,255,255,"+m[6]+")"}g.beginPath();g.moveTo(m[0],m[1]);g.quadraticCurveTo(m[2]-dx/d*20,m[3]-dx/
d*20,m[4]-dx/d*80,m[5]-dy/d*80);g.stroke()}}g.translate(-w/2,-h/2)};document.body.onmousemove=function(b){x=b.clientX-w/2;y=b.clientY-h/2;rd()};
- Description
- Poke around with mouse to find gray hair.
- Base64 encoded
d2l0aChkb2N1bWVudC5ib2R5LnN0eWxlKXtwYWRkaW5nPW1hcmdpbj0wO292ZXJmbG93PSJoaWRkZW4ifWM9ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImMiKTt3PWMud2lkdGg9dGhpcy5pbm5lcldpZHRoO2g9Yy5oZWlnaHQ9dGh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NlbW92ZT1mdW5jdGlvbihiKXt4PWIuY2xpZW50WC13LzI7eT1iLmNsaWVudFktaC8yO3JkKCl9Ow==
- Original source
with(document.body.style){padding=margin=0;overflow='hidden'};
c=document.getElementById('c');
w = c.width = this.innerWidth;
h = c.height = this.innerHeight;
var g = c.getContext('2d');
l = []
function r(w) {return Math.random()*w-w/2}
for (var i = 0; i++ < 999;) {
cw = r(w);
ch = r(h);
l.push([cw, ch, cw+r(20), ch+r(20), cw+r(99), ch+r(99)]);
}
colors = [0, 255, 0];
t = 1;
rd=function() {
g.fillStyle = '#000';
g.fillRect(0,0, w, h);
g.strokeStyle = '#aa0';
g.lineWidth = 1;
i = 5;
if (colors[t] > i-1) {
colors[t] -= i;
colors[(t+1)%3] += i;
} else {
turn=(t+1)%3;
}
//g.strokeStyle = 'rgb('+colors.join(',')+')';
ss = 'rgba('+colors.join(',')+',';
g.translate(w/2, h/2);
for (i in l) {
m = l[i];
dx = x-m[0];
dy = y-m[1];
d = Math.sqrt(dx*dx+dy*dy);
a = 75/d;
a = a > 0.75 ? 0.750 : a;
if (a < 0.15) {continue}
g.strokeStyle = ss+(a)+')';
if (a > 0.6 && r(4)<-1.9) {
m[6] = 1;
}
if (m[6]>0) {
m[6] -= 0.05;
g.strokeStyle = 'rgba(255,255,255,'+m[6]+')';
}
g.beginPath();
g.moveTo(m[0], m[1]);
g.quadraticCurveTo(
m[2]-(dx/d)*20,
m[3]-(dx/d)*20,
m[4]-(dx/d)*80,
m[5]-(dy/d)*80
);
g.stroke();
}
g.translate(-w/2, -h/2);
}
document.body.onmousemove = function(e) {
x = e.clientX-w/2;
y = e.clientY-h/2;
rd()
}