- Author:
- Floriaen
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- floriaen.fr
- Compo:
- classic
- Demo link:
- https://js1k.com/2013-spring/demo/1379
- Shortlink:
- https://js1k.com/1379
- Blog post:
- please update here!
- Bytes:
- 844
- Chars:
- 844
- Submission
window.requestAnimFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b){window.setTimeout(b,1000/60)}})();C=["#1F0B09","#531A1B","#5D1914","#7C3126","#8E4F2E","#8A5B23","#B3913B","#D9A63D"];R=Math.random;A=0.6;P=6.283185307179586;c.width=1000;c.height=1000;function _c2(d){d=(d)%400;var b=Math.floor(d/34);if(b>7){b=7}return C[b]}function _d(b,d,e){r=b*Math.sqrt(e);t=P*d*e;x=r*Math.cos(t);y=r*Math.sin(t);a.beginPath();a.arc(x,y,R()*4+8,0,P,false);a.fillStyle=_c2(e);a.fill();a.lineWidth=2;a.strokeStyle=0;a.stroke()}(function animloop(){requestAnimFrame(animloop);a.save();a.fillStyle=0;a.fillRect(0,0,c.width,c.height);a.translate(400,400);for(var b=0;b<400;b++){_d(14,A+=1e-7,b)}a.restore()})();
- Description
- Moving sunflower's seeds
- Base64 encoded
d2luZG93LnJlcXVlc3RBbmltRnJhbWU9KGZ1bmN0aW9uKCl7cmV0dXJuIHdpbmRvdy5yZXF1ZXN0QW5pbWF0aW9uRnJhbWV8fHdpbmRvdy53ZWJraXRSZXF1ZXN0QW5pbWF0aW9uRnJhbWV8fHdpbmRvdy5tb3pSZXF1ZXN0QW5pbWF0aW9uRnJhbWV8fHdpbmRvdy5vUmVxdWVzdEFuaW1hdGlvbkZyYW1lfHx3aW5kb3cubXNSZXF1ZXN0QW5pbWF0aW9uRnJhbWV8fGZ1bmN0aW9uKGIpe3dpbmRvdy5zZXRUaW1lb3V0KGIsMTAwMC82MCl9fSkoKTtDPVsiIzFGMEIwOSIsIiM1MzFBMUIiLCIjNUQxOTE0IiwiIzdDMzEyNiIsIiM4RTRGMkUiLCIjOEE1QjIzIiwiI0IzOTEzQiIsIiNEOUE2M0QiXTtSPU1hdGgucmFuZG9tO0E9MC42O1A9Ni4yODMxODUzMDcxNzk1ODY7Yy53aWR0aD0xMDAwO2MuaGVpZ2h0PTEwMDA7ZnVuY3Rpb24gX2MyKGQpe2Q9KGQpJTQwMDt2YXIgYj1NYXRoLmZsb29yKGQvMzQpO2lmKGI+Nyl7Yj03fXJldHVybiBDW2JdfWZ1bmN0aW9uIF9kKGIsZCxlKXtyPWIqTWF0aC5zcXJ0KGUpO3Q9UCpkKmU7eD1yKk1hdGguY29zKHQpO3k9cipNYXRoLnNpbih0KTthLmJlZ2luUGF0aCgpO2EuYXJjKHgseSxSKCkqNCs4LDAsUCxmYWxzZSk7YS5maWxsU3R5bGU9X2MyKGUpO2EuZmlsbCgpO2EubGluZVdpZHRoPTI7YS5zdHJva2VTdHlsZT0wO2Euc3Ryb2tlKCl9KGZ1bmN0aW9uIGFuaW1sb29wKCl7cmVxdWVzdEFuaW1GcmFtZShhbmltbG9vcCk7YS5zYXZlKCk7YS5maWxsU3R5bGU9MDthLmZpbGxSZWN0KDAsMCxjLndpZHRoLGMuaGVpZ2h0KTthLnRyYW5zbGF0ZSg0MDAsNDAwKTtmb3IodmFyIGI9MDtiPDQwMDtiKyspe19kKDE0LEErPTFlLTcsYil9YS5yZXN0b3JlKCl9KSgpOw==
- Original source
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback){
window.setTimeout(callback, 1000 / 60);
};
})();
// http://en.wikipedia.org/wiki/Fermat's_spiral
// http://www.ms.unimelb.edu.au/~segerman/papers/sunflower_spiral_fibonacci_metric.pdf
C = ['#1F0B09', '#531A1B', '#5D1914', '#7C3126', '#8E4F2E', '#8A5B23', '#B3913B', '#D9A63D'];
R = Math.random;
A = 0.6;
P = 6.283185307179586; // 2 * Math.PI
c.width = 1000;
c.height = 1000;
function _c2(n) {
n = (n) % 400;
var i = Math.floor(n / 34);
if (i > 7) i = 7;
return C[i];
};
function _d(s, aa, n) {
r = s * Math.sqrt(n);
t = P * aa * n;
x = r * Math.cos(t)
y = r * Math.sin(t)
a.beginPath();
a.arc(x, y, R() * 4 + 8, 0 , P, false);
a.fillStyle = _c2(n);
a.fill();
a.lineWidth = 2;
a.strokeStyle = 0;
a.stroke();
};
(function animloop(){
requestAnimFrame(animloop);
a.save();
a.fillStyle = 0;
a.fillRect(0 ,0, c.width, c.height);
a.translate(400, 400);
for (var i = 0; i < 400; i++) _d(14, A += 0.0000001, i);
a.restore();
})();