- Author:
- Anwerso
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- anwerso.com
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/691
- Shortlink:
- https://js1k.com/691
- Blog post:
- please update here!
- Bytes:
- 805
- Chars:
- 805
- Submission
c=(b=document.body).children[0],S=(M=Math).sin,C=M.cos,R=M.random,b.style.margin=z=r=i=u=t=0,g=e=m=f=.4,b.bgColor="#000",b.style.overflow="hidden",s=c.getContext("2d"),n=(w=c.width=innerWidth+32)*(h=c.height=innerHeight+32)/1000|0;with(c.style)position="absolute",left=top="-16px";for(p=[];i<n;i++)p.push({x:R()*w,y:R()*h});function F(a){a.x=(w+a.x+(S(a.y/53+u)+g))%w;a.y=(h+a.y+(C(a.x/47-u)+m))%h;r=10+(C((a.x+a.y)/50)+S((a.x-a.y)/27+u))*3;s.fillStyle="hsl("+((t+r*15+(a.x/w+a.y/h)*180)%360|0)+",100%,70%)";s.beginPath();s.arc(a.x,a.y,r,0,M.PI*2,0);s.closePath();s.fill()}function L(){z=new Date().getTime();s.fillStyle="rgba(0,0,0,.04)";s.fillRect(0,0,w,h);u=t*.05;for(i=0;i<n;i++)F(p[i]);t++;g=g+(e-g)*.05;m=m+(f-m)*.05;t%100==0&&(R()<0.5?e=-e:f=-f);setTimeout(L,M.max(30-new Date().getTime()+z,1))}L()
- Description
- Yet another "screensaver" on canvas.
- Base64 encoded
Yz0oYj1kb2N1bWVudC5ib2R5KS5jaGlsZHJlblswXSxTPShNPU1hdGgpLnNpbixDPU0uY29zLFI9TS5yYW5kb20sYi5zdHlsZS5tYXJnaW49ej1yPWk9dT10PTAsZz1lPW09Zj0uNCxiLmJnQ29sb3I9IiMwMDAiLGIuc3R5bGUub3ZlcmZsb3c9ImhpZGRlbiIscz1jLmdldENvbnRleHQoIjJkIiksbj0odz1jLndpZHRoPWlubmVyV2lkdGgrMzIpKihoPWMuaGVpZ2h0PWlubmVySGVpZ2h0KzMyKS8xMDAwfDA7d2l0aChjLnN0eWxlKXBvc2l0aW9uPSJhYnNvbHV0ZSIsbGVmdD10b3A9Ii0xNnB4Ijtmb3IocD1bXTtpPG47aSsrKXAucHVzaCh7eDpSKCkqdyx5OlIoKSpofSk7ZnVuY3Rpb24gRihhKXthLng9KHcrYS54KyhTKGEueS81Myt1KStnKSkldzthLnk9KGgrYS55KyhDKGEueC80Ny11KSttKSklaDtyPTEwKyhDKChhLngrYS55KS81MCkrUygoYS54LWEueSkvMjcrdSkpKjM7cy5maWxsU3R5bGU9ImhzbCgiKygodCtyKjE1KyhhLngvdythLnkvaCkqMTgwKSUzNjB8MCkrIiwxMDAlLDcwJSkiO3MuYmVnaW5QYXRoKCk7cy5hcmMoYS54LGEueSxyLDAsTS5QSSoyLDApO3MuY2xvc2VQYXRoKCk7cy5maWxsKCl9ZnVuY3Rpb24gTCgpe3o9bmV3IERhdGUoKS5nZXRUaW1lKCk7cy5maWxsU3R5bGU9InJnYmEoMCwwLDAsLjA0KSI7cy5maWxsUmVjdCgwLDAsdyxoKTt1PXQqLjA1O2ZvcihpPTA7aTxuO2krKylGKHBbaV0pO3QrKztnPWcrKGUtZykqLjA1O209bSsoZi1tKSouMDU7dCUxMDA9PTAmJihSKCk8MC41P2U9LWU6Zj0tZik7c2V0VGltZW91dChMLE0ubWF4KDMwLW5ldyBEYXRlKCkuZ2V0VGltZSgpK3osMSkpfUwoKQ==
- Original source
c = (b = document.body).children[0],
S = (M = Math).sin,
C = M.cos,
R = M.random,
b.style.margin = z = r = i = u = t = 0,
g = e = m = f = .4,
b.bgColor = '#000',
b.style.overflow = 'hidden',
s = c.getContext('2d'),
n = (w = c.width = innerWidth + 32) * (h = c.height = innerHeight + 32) / 1e3 | 0;
with (c.style) {
position = 'absolute';
left = top = '-16px';
}
for (p = []; i < n; i++) p.push({
x: R() * w,
y: R() * h
});
function F(p) {
p.x = (w + p.x + (S(p.y / 53 + u) + g)) % w;
p.y = (h + p.y + (C(p.x / 47 - u) + m)) % h;
r = 10 + (C((p.x + p.y) / 50) + S((p.x - p.y) / 27 + u)) * 3;
s.fillStyle = 'hsl(' + ((t + r * 15 + (p.x / w + p.y / h) * 180) % 360 | 0) + ',100%,70%)';
s.beginPath();
s.arc(p.x, p.y, r, 0, M.PI * 2, 0);
s.closePath();
s.fill();
}
function L() {
z = new Date().getTime();
s.fillStyle = 'rgba(0,0,0,.04)';
s.fillRect(0, 0, w, h);
u = t * .05;
for (i = 0; i < n; i++)
F(p[i]);
t++;
g = g + (e - g) * .05;
m = m + (f - m) * .05;
t % 100 == 0 && (R() < 0.5 ? e = -e : f = -f);
setTimeout(L, M.max(30 - new Date().getTime() + z, 1));
};
L()