Various animation effects:

Most are initialized with statements such as these . Note since the illustrations below share certain global variables (to make code easier to read) only one animation can run at a time. You may need to reload browser to rerun some of these animations.

description effect code
Single-point
(zero-dimensional)
flip-book;
Advance on
mouseclick.
Loop to start frame.
function animate0( ){
 count=count+1;
 if (count>frames-1) count=0;
 document.screen0.src=pix[count].src;
}
Single-point
(zero-dimensional)
animation;
Triggered by
mouseclick.
Resets to start frame.
function animatea( ){
 if (count>frames-1) {
  document.screen.src=pix[0].src;
  count=0;
 return;}
 document.screen.src=pix[count].src;
 count=count+1;
 window.setTimeout("animatea()",delay);
}
Single-point
(zero-dimensional)
animation;
Looping frames;
Switched by
mouseclick.
Doesn't reset to
start frame.
function animateb( ){
 if (boo= =false) {
  count=0;
 return;}
 document.screen2.src=pix[count].src;
 count=count+1;
 if (count>frames-1) count=0;
 window.setTimeout("animateb( )",delay);
}
Single-point
(zero-dimensional)
animation;
Oscillating frames;
Switched by
mouseclick.
Doesn't reset
to start pic.
function animatec( ){
 if (boo==false) {
 return;}
 document.screen3.src=pix[count].src;
 count=count+direction;
 if (count>frames-2||count<1) direction=-direction;
 window.setTimeout("animatec( )",delay);
}
Linear (one-dimensional)
rollover; Advance
on mouseclick.
Loop to start cell.
function animated(){
 pos=pos+1;
 document.images[pos+3].src="pink.gif";
 if (pos>ncells-1) pos=0;
 document.images[pos+4].src="ball.gif";
}
Linear (one-dimensional)
animation; Trigger on mouseclick.
Loop to start cell.
function animatee(){
 if (boo==false) return;
 pos=pos+1;
 document.images[pos+6].src="pink.gif";
 if (pos>ncells-1) pos=0;
 document.images[pos+7].src="ball.gif";
 window.setTimeout("animatee()",delay+100);
}
Oscillating one-dimensional
animation; Trigger on mouseclick.
function animatef(){
 if (boo==false) return;
 pos=pos+direction;
 document.images[pos+9].src="pink.gif";
 if (pos>ncells-1||
(pos<2&&direction==-1))< BR> direction=-direction;
 document.images[pos+9+direction].src="ball.gif";
 window.setTimeout("animatef()",delay+100);
}
Choreographed nonlinear animation;  Rollover only at key cells -- note exception handling at array boundary.
Trigger on mouseclick.
function animateg(){
 ncells=16;
 order = new Array(4,0,1,2,3,7,11,15,14,10,6,5,9,13,12,8);
 if (boo==false) return;
 pos=pos+1;
 if (pos<ncells-1) document.images[order[pos+1]+13].src="ball.gif";
 else document.images[order[0]+13].src="ball.gif";
 if (pos>ncells-1) {
  pos=0;
  document.images[order[1]+13].src="ball.gif";
  }
 document.images[order[pos]+13].src="pink.gif";
 window.setTimeout("animateg()",delay+100);
}
Choreographed nonlinear animation; rollover of entire array.
Trigger on mouseclick.
function animateh(){
 ncells=16;
 order = new Array(0,1,2,3,7,11,15,14,10,6,5,9,13,12,8,4);
 if (boo==false) return;
 var hold=document.images[order[ncells-1]+29].src;
  for (i=ncells-1;i>0;i--){
    document.images[order[i]+29].src=document.images[order[i-1]+29].src;
  }
 document.images[order[0]+29].src=hold;
 window.setTimeout("animateh( )",delay+100);
}
Interactive nonlinear animation; rollover of entire array.
Rollover of target cell on mouseclick.

How many can you make black?

function Y(j){
 if (!loaded) {loadY();loaded=true}
 if (document.images[j+45].src==pink.src){
  boo=!boo;
  animatei();//just like animateh, above
  document.images[j+45].src="ball.gif";
  boo=true;
 } else {
  boo=false;
  animatei( );//just like animateh, above
  document.images[j+45].src="pink.gif";
 }
 return;
}
Multiple single-dimension animation.
function animatej(){
 if (boo==false) return;
 for (i=0;i<3;i++){
  hold=document.images[61+3*i+2].src;
  document.images[61+3*i+2].src=document.images[61+3*i+1].src;
  document.images[61+3*i+1].src=document.images[61+3*i].src;
  document.images[61+3*i].src=hold;
 }
 window.setTimeout("animatej()",delay+100);
}