Physics Hype - 3D physics engine - click or reload to drop another spinning object - full screen for best effect.
for(_='c.Z0,YRect(YYo,XZfillWWStyle="hsla("+g+",99%,"+-80*T+"%,"+I+")"V;V;WXUMath.Ot*Osin(6.3/r*iNo+g*NLP[i].K=KJy,wJzH,vJG,uJF(u*EP[j].D-DC),B[s++]A,l=OsqrtEu+v*v+w*wB@)%rFxCxGyCHCz@ SA/l,&&(=T*-j=(i+1+r/2*f+o/4=1a.widthfor(i=r;i--;);1;g==0)*+=9*K=l,function(){,K200],f=600/(-m.zBZ eTo(m.x,m.yB,!(i%2)&0>=TV,W())u/v/w/Orandom())%r,m=P[j linPA={x:g-R,y:-LBz:-3*L+1.6Be:Yf:N+1.6T,d:-NT,b:Ya:Yc:0},R=-R,t/t b=(KeCeu+(KfCfv+(KdCdw,T=-(l-SA+b)/40b+ua+vc+w,Dbu,Dav,Dcw k=un=vQ=w2 T=(v*Q-w*nKx-EQ-w*kKy+En-v*kKzFxGH@ZbeginPath(Bm=P[i mov132Tr;M=I;o;b.onclick=M=!M};h=a.height*=o/;=o;setInterval(if(M){s;P=[];S=[];r|9*+3;T=.3+/2;R=g*+30;t=r%2*/2+1;,;r=s;M=s2=l}for(q5;q--;){KbJc=sa/o,2,;Ke+Jbf+Jad+Jcxeyfzd,<KyTJa/2fJa=wFeGd@Keudvy=B-<Kz&&0<KdIJdz=-)}T=-199;ZclearXh)Uh)Uo/4)R=T/l/-2,Zstroke()/=l;I>I?I+=.1:1},15);';g=/[^!-?IMP-T[-}]/.exec(_);)with(_.split(g))_=join(shift());eval(_)
Zm9yKF89J2MuWjAsWVJlY3QoWVlvLFhaZmlsbFdXU3R5bGU9ImhzbGEoIitnKyIsOTklLCIrLTgwKlQrIiUsIitJKyIpIlY7VjtXWFVNYXRoLk90Kk9zaW4oNi4zL3IqaU5vK2cqTkxQW2ldLks9S0p5LHdKekgsdkpHLHVKRih1KkVQW2pdLkQtREMpLEJbcysrXUEsbD1Pc3FydEV1K3Yqdit3KndCQCklck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MoXyk7KXdpdGgoXy5zcGxpdChnKSlfPWpvaW4oc2hpZnQoKSk7ZXZhbChfKQ==
p=0; M=B=1; W=1200;
b.onclick=function(){M=!M};
H = a.height *= W/a.width;
a.width = W;
setInterval(function() {
if (M) { //Create spinning object
s=0;P=[];S=[];
C=200;
p = 0|Math.random()*9+3;
T = .3+Math.random()/2;
R = C*Math.random()+30;
t = Math.random()*(p%2)/2+1;
for (i=p; i--;) {
P[s++] = {x:C-R, y:(-W+C*t*Math.sin(6.3/p*i)), z:(-3*W+C*t*Math.sin(6.3/p*i+1.6)), v:0, u:t*Math.sin(6.3/p*i+1.6)*T, q:-t*Math.sin(6.3/p*i)*T, f:0, g:0, h:0};R=-R;t=1/t;
P[s++] = {x:C-R, y:(-W+C*t*Math.sin(6.3/p*i)), z:(-3*W+C*t*Math.sin(6.3/p*i+1.6)), v:0, u:t*Math.sin(6.3/p*i+1.6)*T, q:-t*Math.sin(6.3/p*i)*T, f:0, g:0, h:0};R=-R;t=1/t;
}
p=s;M=s=0;
for (i=p; i--;) {
j = (i+1)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
S[s++] = l;
j = (i+2)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
S[s++] = l;
j = (i+1+p/2)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
S[s++] = l;
}
}
for (q=15; q--;) {
for (i=p; i--;) { //3D PHYSICS
P[i].f=P[i].h=s=0;
P[i].g=1/W; //External forces (gravity)
}
for (i=p; i--;) {
j = (i+1)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
u = u/l; v = v/l; w = w/l;
b = (P[i].v-P[j].v)*u + (P[i].u-P[j].u)*v + (P[i].q-P[j].q)*w;
T = -(l-S[s++]+b)/40; //Internal forces
P[i].f += T*u;
P[i].g += T*v;
P[i].h += T*w;
P[j].f -= T*u;
P[j].g -= T*v;
P[j].h -= T*w;
j = (i+2)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
u = u/l; v = v/l; w = w/l;
b = (P[i].v-P[j].v)*u + (P[i].u-P[j].u)*v + (P[i].q-P[j].q)*w;
T = -(l-S[s++]+b)/40; //Internal forces
P[i].f += T*u; //Newtons 3rd law
P[i].g += T*v;
P[i].h += T*w;
P[j].f -= T*u;
P[j].g -= T*v;
P[j].h -= T*w;
j = (i+1+p/2)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
u = u/l; v = v/l; w = w/l;
b = (P[i].v-P[j].v)*u + (P[i].u-P[j].u)*v + (P[i].q-P[j].q)*w;
T = -(l-S[s++]+b)/40; //Internal forces
P[i].f += T*u; //Newtons 3rd law
P[i].g += T*v;
P[i].h += T*w;
P[j].f -= T*u;
P[j].g -= T*v;
P[j].h -= T*w;
}
for (i=p; i--;) { //Newtons 2nd law
P[i].v += P[i].f; //Update velocity
P[i].u += P[i].g;
P[i].q += P[i].h;
P[i].x += P[i].v*9; //Update position
P[i].y += P[i].u*9;
P[i].z += P[i].q*9;
if (P[i].y>200) { //Adjust for external forces (collisions)
T = P[i].g/2;
P[i].u = P[i].g = w = 0;
u = P[i].v;
v = P[i].q;
l = Math.sqrt(u*u + v*v + w*w);
u = u/l; v = v/l; w = w/l;
P[i].v -= T*u;
P[i].q -= T*v;
P[i].y = 200;
}
if (P[i].z>-200) {
if (P[i].q>0) {B=P[i].q = 0; P[i].z = -200};
}
}
}
T=-1;
C=99;
c.clearRect(0,0,W,H);
c.fillStyle="hsla("+C+",99%," + -80*T +"%,"+B+")";
c.fillRect(0,0,W,H);
C=200;
c.fillStyle="hsla("+C+",99%," + -80*T +"%,"+B+")";
c.fillRect(0,0,W,W/4);
C=R;
for (i=p; i--;) { //3D GRAPHICS
j = (i+1)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
U = u/l; V = v/l; Q = w/l;
j = (i+2)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
u = u/l; v = v/l; w = w/l;
T = (v*Q-w*V)*P[i].x - (u*Q-w*U)*P[i].y + (u*V-v*U)*P[i].z;
u = P[i].x;
v = P[i].y;
w = P[i].z;
l = Math.sqrt(u*u + v*v + w*w);
c.beginPath();
m=P[i]; f = 3*200/(200-m.z);
c.moveTo( m.x*f+W/4, m.y*f + W/4 );
j = (i+1)%p;
m=P[j]; f = 3*200/(200-m.z);
c.lineTo( m.x*f+W/4, m.y*f + W/4 );
j = (i+3)%p;
m=P[j]; f = 3*200/(200-m.z);
c.lineTo( m.x*f+W/4, m.y*f + W/4 );
j = (i+2)%p;
m=P[j]; f = 3*200/(200-m.z);
c.lineTo( m.x*f+W/4, m.y*f + W/4 );
T=T/l/-2;
if ((!(i%2))&(T<=0)) {
c.fillStyle="hsla("+C+",99%," + -80*T +"%,"+B+")";
c.fill();
}
c.stroke();
}
for (i=p; i--;) {
j = (i+1)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
U = u/l; V = v/l; Q = w/l;
j = (i+2)%p;
u = P[i].x - P[j].x;
v = P[i].y - P[j].y;
w = P[i].z - P[j].z;
l = Math.sqrt(u*u + v*v + w*w);
u = u/l; v = v/l; w = w/l;
T = (v*Q-w*V)*P[i].x - (u*Q-w*U)*P[i].y + (u*V-v*U)*P[i].z;
u = P[i].x;
v = P[i].y;
w = P[i].z;
l = Math.sqrt(u*u + v*v + w*w);
c.beginPath();
m=P[i]; f = 3*200/(200-m.z);
c.moveTo( m.x*f+W/4, m.y*f + W/4 );
j = (i+1)%p;
m=P[j]; f = 3*200/(200-m.z);
c.lineTo( m.x*f+W/4, m.y*f + W/4 );
j = (i+3)%p;
m=P[j]; f = 3*200/(200-m.z);
c.lineTo( m.x*f+W/4, m.y*f + W/4 );
j = (i+2)%p;
m=P[j]; f = 3*200/(200-m.z);
c.lineTo( m.x*f+W/4, m.y*f + W/4 );
T=T/l;
if ((!(i%2))&(T<=0)) {
c.fillStyle="hsla("+C+",99%," + -80*T +"%,"+B+")";
c.fill();
}
}
B=(B<1)?B+=.1:1; //Flash effect
},15);