B=document.body.children[0],C=B.getContext("2d");for(k in C){C[k[0]+(k[5]||0)]=C[k]}B.width=B.height=S=600,V=20,D=50,E=[],s=1,R=Math.random;C.fillStyle="rgba(0,0,0,.5)";document.write("<style>html,body{margin:0;padding:0;height:100%;background:#000}#c{display:block;margin:0 auto}</style>");B.onclick=function(){with(B.style)parseInt(width)==S?(width=window.innerWidth+"px")&(height=window.innerHeight+"px"):(width=height=S+"px")};for(i=0;i<V;){E[i++]={x:R()*S|0,y:R()*S|0,u:R()*2*D-D,v:R()*2*D-D,d:0}}setInterval('C.globalCompositeOperation="source-over";C.fillRect(0,0,S,S);C.globalCompositeOperation="lighter";for(j=V;j;j--){F=[],t=(S-s)/2;for(i=V;i;i--){with(b=E[i%V],E[i-1]){X=x+E[i%V].u*0.1;Y=y+E[i%V].v*0.1;X=X<0?X+s:X%s;Y=Y<0?Y+s:Y%s;d=Math.sqrt((X-x)*(X-x)+(Y-y)*(Y-y));x=X;y=Y;F[i-1]={x:x+(b.x-x)/2,y:y+(b.y-y)/2}}}for(var i=V;s-1&&i;i--){b=E[i%V];C.bP();C.mo(t+F[i-1].x,t+F[i-1].y);C.qa(t+b.x,t+b.y,t+F[i%V].x,t+F[i%V].y);C.strokeStyle="hsla("+(j/V*360)+",100%,"+(50-b.d/S*20)+"%,.5)";C.stroke()}s<S?s++:0}',120)
/*
* Name: Visual rainbow thingy.
* Author: Jonas Höglund (firefly.nu)
* Date: 2010-09-09
*
* S: Size (width/height of canvas).
* N: Number of lines in rainbow.
* D: Maximum distance between outer edge lines.
* V: Vertex count.
*
* B: Canvas.
* C: Context.
* E: Vertex array.
* - x, y: position; u, v: direction; d: delta.
*/
/*
B = document.body.children[0], C = B.getContext('2d');
for(k in C)C[k[0]+(k[5]||0)]=C[k];
B.width=B.height=S=600, V=20, D=50, E=[], s=1, R=Math.random;
C.fillStyle = "rgba(0,0,0,.5)";
document.write("<style>html,body{margin:0;padding:0;height:100%;background:#000}#c{display:block;margin:0 auto}</style>");
B.onclick = function() { // Click for "fullscreen mode".
with (B.style) {
// parseInt(width)-S ? (width=height=S) : (width=window.innerWidth) & (height=window.innerHeight)
parseInt(width) == S ? (width=window.innerWidth+"px") & (height=window.innerHeight+"px") : (width=height=S+"px")
}
};
for (i=0; i<V;) {
E[i++] = {
x: R()*S|0,
y: R()*S|0,
u: R()*2*D-D,
v: R()*2*D-D,
d: 0
};
}
setInterval(function() {
C.globalCompositeOperation = "source-over";
// C.fillRect(0, 0, S, S);
C.fillRect(0, 0, S, S);
C.globalCompositeOperation = "lighter";
for (j=V; j; j--) {
F = [], t = (S-s)/2;
// Calculation loop.
for (i=V; i; i--) {
with (b=E[i%V], E[i-1]) {
X = x + E[i%V].u * .1;
Y = y + E[i%V].v * .1;
// X = X < 0 ? X + S : X % S;
// Y = Y < 0 ? Y + S : Y % S;
X = X < 0 ? X + s : X % s;
Y = Y < 0 ? Y + s : Y % s;
d = Math.sqrt((X-x)*(X-x) + (Y-y)*(Y-y));
x = X;
y = Y;
F[i-1] = {x: x + (b.x-x)/2, y: y + (b.y-y)/2};
}
}
// Drawing loop.
for (var i=V; s-1 && i; i--) {
b = E[i%V];
// C.beginPath();
C.bP();
// C.moveTo(t+F[i-1].x, t+F[i-1].y);
// C.quadraticCurveTo(t+b.x, t+b.y, t+F[i%V].x, t+F[i%V].y);
C.mo(t+F[i-1].x, t+F[i-1].y);
C.qa(t+b.x, t+b.y, t+F[i%V].x, t+F[i%V].y);
C.strokeStyle = "hsla(" + (j/V*360) + ",100%," + (50-b.d/S*20) + "%,.5)";
C.stroke();
}
s < S ? s++ : 0;
}
}, 120);
//*/