- Author:
- Elias Schütt
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- elias-schuett.de
- Compo:
- classic
- Demo link:
- https://js1k.com/2013-spring/demo/1384
- Shortlink:
- https://js1k.com/1384
- Blog post:
- please update here!
- Bytes:
- 789
- Chars:
- 789
- Submission
b.style.margin=0;b.style.overflow="hidden";M=Math;c.width=innerWidth;c.height=innerHeight;CX=c.width/2|0;CY=c.height/2|0;l=[];for(i=10;i--;){l.push([CX,CY,M.random()*M.PI*2])}a.fillStyle="#000";a.strokeStyle="#9ff";a.lineWidth=.01;a.globalCompositeOperation="lighter";a.fillRect(0,0,c.width,c.height);f=0;s=5;setInterval(function(){if(!f&&l.length<=500){l.push([CX,CY,M.random()*M.PI*2])}else if(!f){a.fillStyle="rgba(255,255,255,0.01)";a.strokeStyle="#000";a.lineWidth=.5;a.globalCompositeOperation="source-over";l=[];for(i=1e3;i--;){l.push([CX,CY,M.random()*M.PI*2])}f=1;s=10}else{a.fillRect(0,0,c.width,c.height)}a.beginPath();for(i=l.length;i--;){z=l[i][2];a.lineTo(l[i][0],l[i][1],1,1);l[i][0]+=s*M.cos(z)|0;l[i][1]+=s*M.sin(z)|0;l[i][2]+=.1*M.sqrt(z/(z*180/M.PI))}a.stroke()},1e3/60)
- Description
- First JS1K entry!
Not too happy with the result in FF and Opera, but at least it works.
- Base64 encoded
Yi5zdHlsZS5tYXJnaW49MDtiLnN0eWxlLm92ZXJmbG93PSJoaWRkZW4iO009TWF0aDtjLndpZHRoPWlubmVyV2lkdGg7Yy5oZWlnaHQ9aW5uZXJIZWlnaHQ7Q1g9Yy53aWR0aC8yfDA7Q1k9Yy5oZWlnaHQvMnwwO2w9W107Zm9yKGk9MTA7aS0tOyl7bC5wdXNoKFtDWCxDWSxNLnJhbmRvbSgpKk0uUEkqMl0pfWEuZmlsbFN0eWxlPSIjMDAwIjthLnN0cm9rZVN0eWxlPSIjOWZmIjthLmxpbmVXaWR0aD0uMDE7YS5nbG9iYWxDb21wb3NpdGVPcGVyYXRpb249ImxpZ2h0ZXIiO2EuZmlsbFJlY3QoMCwwLGMud2lkdGgsYy5oZWlnaHQpO2Y9MDtzPTU7c2V0SW50ZXJ2YWwoZnVuY3Rpb24oKXtpZighZiYmbC5sZW5ndGg8PTUwMCl7bC5wdXNoKFtDWCxDWSxNLnJhbmRvbSgpKk0uUEkqMl0pfWVsc2UgaWYoIWYpe2EuZmlsbFN0eWxlPSJyZ2JhKDI1NSwyNTUsMjU1LDAuMDEpIjthLnN0cm9rZVN0eWxlPSIjMDAwIjthLmxpbmVXaWR0aD0uNTthLmdsb2JhbENvbXBvc2l0ZU9wZXJhdGlvbj0ic291cmNlLW92ZXIiO2w9W107Zm9yKGk9MWUzO2ktLTspe2wucHVzaChbQ1gsQ1ksTS5yYW5kb20oKSpNLlBJKjJdKX1mPTE7cz0xMH1lbHNle2EuZmlsbFJlY3QoMCwwLGMud2lkdGgsYy5oZWlnaHQpfWEuYmVnaW5QYXRoKCk7Zm9yKGk9bC5sZW5ndGg7aS0tOyl7ej1sW2ldWzJdO2EubGluZVRvKGxbaV1bMF0sbFtpXVsxXSwxLDEpO2xbaV1bMF0rPXMqTS5jb3Moeil8MDtsW2ldWzFdKz1zKk0uc2luKHopfDA7bFtpXVsyXSs9LjEqTS5zcXJ0KHovKHoqMTgwL00uUEkpKX1hLnN0cm9rZSgpfSwxZTMvNjAp
- Original source
b.style.margin = 0;
b.style.overflow = "hidden";
M = Math;
c.width = innerWidth;
c.height = innerHeight;
CX = c.width / 2 | 0;
CY = c.height / 2 | 0;
l = [];
for (i = 10; i--;) { l.push([CX, CY, M.random() * M.PI * 2]); }
a.fillStyle = "#000";
a.strokeStyle = "#9ff";
a.lineWidth = 0.01;
a.globalCompositeOperation = "lighter";
a.fillRect(0, 0, c.width, c.height);
f = 0;
s = 5;
setInterval(function() {
if (!f && l.length <= 500) {
l.push([CX, CY, M.random() * M.PI * 2]);
} else if (!f) {
a.fillStyle = "rgba(255,255,255,0.01)";
a.strokeStyle = "#000";
a.lineWidth = 0.5;
a.globalCompositeOperation = "source-over";
l = [];
for (i = 1000; i--;) { l.push([CX, CY, M.random() * M.PI * 2]); }
f = 1;
s = 10;
} else { a.fillRect(0, 0, c.width, c.height); }
a.beginPath();
for (i = l.length; i--;) {
z = l[i][2];
a.lineTo(l[i][0], l[i][1], 1, 1);
l[i][0] += s * M.cos(z) | 0;
l[i][1] += s * M.sin(z) | 0;
l[i][2] += 0.1 * M.sqrt(z / (z * 180 / M.PI));
}
a.stroke();
}, 1000 / 60);