- Author:
- Yoeran
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- yoeran.com
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/93
- Shortlink:
- https://js1k.com/93
- Blog post:
- please update here!
- Bytes:
- 766
- Chars:
- 766
- Submission
a=document;ab=a.body.style;ab.overflow='hidden';ab.margin=ab.padding=0;ab.width='100%';ab.height='800px';b=a.getElementById("c");b.width=a.width;b.height=a.height;c=b.style;d=b.getContext("2d");e=[];f=Math;g=setInterval;h=b.height;w=b.width;j=40;k=['f29','ef0','99f'];ab.backgroundColor=c.backgroundColor='#000';function C(n){t=this;t.q="#"+k[f.round(f.random()*3)];t.r=t.s=0;t.t=t.u=t.v=t.w=1;t.x=w/2;t.y=h/2;e[n]=t;g('e['+n+'].U()',j);}C.prototype.U=function(){t=this;t.r+=f.random()*.5-0.25;t.s+=f.random()*.5-0.25;t.r*=t.t;t.s*=t.u;t.x+=t.r;t.y+=t.s;if(t.x>=w||t.x<=0){t.t*=-1;}if(t.y>=h||t.y<=0){t.u*=-1;}d.fillStyle=t.q;d.fillRect(t.x,t.y,2,2);};g('G()',j);function G(){d.fillStyle='rgba(0,0,0,0.2)';d.fillRect(0,0,w,h);}for(var i=0;i<100;i++){var n=new C(i);}
- Description
- Just playing with Brownian motion.
- Base64 encoded
YT1kb2N1bWVudDthYj1hLmJvZHkuc3R5bGU7YWIub3ZlcmZsb3c9J2hpZGRlbic7YWIubWFyZ2luPWFiLnBhZGRpbmc9MDthYi53aWR0aD0nMTAwJSc7YWIuaGVpZ2h0PSc4MDBweCc7Yj1hLmdldEVsZW1lbnRCeUlkKCJjIik7Yi53aWR0aD1hLndpZHRoO2IuaGVpZ2h0PWEuaGVpZ2h0O2M9Yi5zdHlsZTtkPWIuZ2V0Q29udGV4dCgiMmQiKTtlPVtdO2Y9TWF0aDtnPXNldEludGVydmFsO2g9Yi5oZWlnaHQ7dz1iLndpZHRoO2o9NDA7az1bJ2YyOScsJ2VmMCcsJzk5ZiddO2FiLmJhY2tncm91bmRDb2xvcj1jLmJhY2tncm91bmRDb2xvcj0nIzAwMCc7ZnVuY3Rpb24gQyhuKXt0PXRoaXM7dC5xPSIjIitrW2Yucm91bmQoZi5yYW5kb20oKSozKV07dC5yPXQucz0wO3QudD10LnU9dC52PXQudz0xO3QueD13LzI7dC55PWgvMjtlW25dPXQ7ZygnZVsnK24rJ10uVSgpJyxqKTt9Qy5wcm90b3R5cGUuVT1mdW5jdGlvbigpe3Q9dGhpczt0LnIrPWYucmFuZG9tKCkqLjUtMC4yNTt0LnMrPWYucmFuZG9tKCkqLjUtMC4yNTt0LnIqPXQudDt0LnMqPXQudTt0LngrPXQucjt0LnkrPXQucztpZih0Lng+PXd8fHQueDw9MCl7dC50Kj0tMTt9aWYodC55Pj1ofHx0Lnk8PTApe3QudSo9LTE7fWQuZmlsbFN0eWxlPXQucTtkLmZpbGxSZWN0KHQueCx0LnksMiwyKTt9O2coJ0coKScsaik7ZnVuY3Rpb24gRygpe2QuZmlsbFN0eWxlPSdyZ2JhKDAsMCwwLDAuMiknO2QuZmlsbFJlY3QoMCwwLHcsaCk7fWZvcih2YXIgaT0wO2k8MTAwO2krKyl7dmFyIG49bmV3IEMoaSk7fQ==
- Original source
a=document;
ab=a.body.style;
ab.overflow='hidden';
ab.margin=ab.padding=0;
ab.width='100%';
ab.height='800px';
b=a.getElementById("c");
b.width=a.width;
b.height=a.height;
c=b.style;
d=b.getContext("2d");
e=[];
f=Math;
g=setInterval;
h=b.height;
w=b.width;
j=40;
k=['f29','ef0','99f'];
ab.backgroundColor=c.backgroundColor='#000';
function C(n){
t=this;
t.q="#"+k[f.round(f.random()*3)];
t.r=t.s=0;
t.t=t.u=t.v=t.w=1;
t.x=w/2;
t.y=h/2;
e[n]=t;
g('e['+n+'].U()',j);
}
C.prototype.U = function(){
t=this;
t.r+=f.random()*.5-0.25;
t.s+=f.random()*.5-0.25;
t.r*=t.t;
t.s*=t.u;
t.x+=t.r;
t.y+=t.s;
if(t.x>=w||t.x<=0){t.t*=-1;}
if(t.y>=h||t.y<=0){t.u*=-1;}
d.fillStyle=t.q;
d.fillRect(t.x,t.y,2,2);
}
g('G()',j);
function G(){
d.fillStyle='rgba(0,0,0,0.2)';
d.fillRect(0,0,w,h);
}
for(var i=0;i<100;i++){var n=new C(i);}