- Author:
- razorwolf
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/499
- Shortlink:
- https://js1k.com/499
- Blog post:
- please update here!
- Bytes:
- 1015
- Chars:
- 1015
- Submission
var bod=document.body;
bod.style.margin="0";
bod.style.overflow="hidden";
var w=window.innerWidth,h=window.innerHeight;
function r(m){return Math.ceil(m*Math.random());
}function p(n){var t=this;t.n=n;t.x=new Array(n);
t.y=new Array(n);t.vx=new Array(n);t.vy=new Array(n);
for(i=0;i!=n;i++){t.x[i]=r(w);t.y[i]=r(h);
t.vx[i]=r(5);t.vy[i]=r(5);}t.n=function(){
for(var i=0;i!=n;i++){
t.x[i]+=t.vx[i];t.y[i]+=t.vy[i];
if(t.x[i]>w||t.x[i]<0)t.vx[i]*=-1;
if(t.y[i]>h||t.y[i]<0)t.vy[i]*=-1;
}}}
function bx(color,n){
var t=this;t.n=n;t.color=color;
t.c=new p(4);t.d=function(){
C.strokeStyle=color;
C.beginPath();for(i=0;i!=4;i++)t.plot(i);C.stroke();t.c.n();
}
t.plot=function(s){for(var i=0;i!=5;i++){d=i%4;
C.lineTo(t.c.x[d]+(2+t.c.vx[d]*s),t.c.y[d]+(2+t.c.vy[d]*s));
}}} var c=document.getElementById("c");c.height=h;c.width=w;
var B=new bx("red");var B2=new bx("green");var C=c.getContext("2d");
function D(){C.fillStyle="black";C.rect(0,0,w,h);C.fill();B.d();B2.d();}setInterval("D()",25);
- Description
- A clone of the windows Mystify screensaver
- Base64 encoded
dmFyIGJvZD1kb2N1bWVudC5ib2R5Ow0KYm9kLnN0eWxlLm1hcmdpbj0iMCI7DQpib2Quc3R5bGUub3ZlcmZsb3c9ImhpZGRlbiI7DQp2YXIgdz13aW5kb3cuaW5uZXJXaWR0aCxoPXdpbmRvdy5pbm5lckhlaWdodDsNCmZ1bmN0aW9uIHIobSl7cmV0dXJuIE1hdGguY2VpbChtKk1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jdCgwLDAsdyxoKTtDLmZpbGwoKTtCLmQoKTtCMi5kKCk7fXNldEludGVydmFsKCJEKCkiLDI1KTsNCg==
- Original source
<!doctype html>
<html>
<head>
<title>JS1k,1k demo submission [id]</title>
<meta charset="utf-8"/>
</head>
<body>
<canvas id="c"></canvas>
<script>var bod=document.body;
bod.style.margin="0";
bod.style.overflow="hidden";
var w=window.innerWidth,h=window.innerHeight;
function r(m){return Math.ceil(m*Math.random());
}function p(n){var t=this;t.n=n;t.x=new Array(n);
t.y=new Array(n);t.vx=new Array(n);t.vy=new Array(n);
for(i=0;i!=n;i++){t.x[i]=r(w);t.y[i]=r(h);
t.vx[i]=r(5);t.vy[i]=r(5);}t.n=function(){
for(var i=0;i!=n;i++){
t.x[i]+=t.vx[i];t.y[i]+=t.vy[i];
if(t.x[i]>w||t.x[i]<0)t.vx[i]*=-1;
if(t.y[i]>h||t.y[i]<0)t.vy[i]*=-1;
}}}
function bx(color,n){
var t=this;t.n=n;t.color=color;
t.c=new p(4);t.d=function(){
C.strokeStyle=color;
C.beginPath();for(i=0;i!=4;i++)t.plot(i);C.stroke();t.c.n();
}
t.plot=function(s){for(var i=0;i!=5;i++){d=i%4;
C.lineTo(t.c.x[d]+(2+t.c.vx[d]*s),t.c.y[d]+(2+t.c.vy[d]*s));
}}} var c=document.getElementById("c");c.height=h;c.width=w;
var B=new bx("red");var B2=new bx("green");var C=c.getContext("2d");
function D(){C.fillStyle="black";C.rect(0,0,w,h);C.fill();B.d();B2.d();}setInterval("D()",25);
</script>
</body>
</html>