Newsgroup: it.comp.lang.javascript
Titolo: animazione js come vederla

c'è da qualche parte su internet un demo che illustra il funzionamento 
animato della pagina seguente?grazie e ciao<!DOCTYPE HTML PUBLIC 
"-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from 
url=(0102)file://\\CHRISTINA\No%20Starch%20Press\BOOKS\BOOK%20OF%20JAVASCRIPT%202E\CD\from%20PR\ch01\fig1-1.html 
 -->
<!-- saved from 
url=(0089)
http://hotwired.lycos.com/webmonkey/demo/96/35/metasyntactic.cgi?redir=Yes&cols=28&rows=9
 
 --><HTML><HEAD><TITLE>metasyntactic variable</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<SCRIPT language=javascript>
 
/* This is the generative array script.  It displays x amount of gifs to
fill the width of the screen, and most of the height.  It then goes about
changing the image array and adding different gifs from the same object set
and playing the associated sound that goes along with it.  After a set
amount of time (or user imput) the object set "bleeds" into a different set
which then progresses for a set amount of time. */
 
//Here is where we declare all of our varibles and arrays.
 
var basedir = "fig1-1_files/";
var imagedir = "";
var sounddir = "sound/";
var cellNum = null;
var wait = 10;
var imagesize = 16;
var firstobj = null;
var stuff = null;
var loadObject = null;
var morestuff = null;
 
objects = new Array("binary", "blocks", "dots", "letters", "motion");
binary = new Array("off", "on", "blank");
blocks = new Array("all", "botleft", "botright", "down-t", "horizontal", 
"left-t", "right-t", "topleft", "topright", "up-t", "vertical", "blank");
dots = new Array("blue", "green", "orange", "purple", "red", "yellow", 
"blank");
letters = new Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", 
"blank");
motion = new Array("down", "left", "right", "up", "blank");
working = new Array();
working = blocks;
 
var screenCols = 28;
var screenRows = 9;
 
 
// The procedular portion of the script.
 
// This waits for everything to load up before starting it all
 
function Start() {
 
  loaded = 1;
  keepGoing();
  //  for (b=0; b < voices; b++) {
  //    keepSoundGoing(b);
  //  }
}
 
// This is the function that will determine What the first set will be.
 
function first() {
  firstobj = Math.round(Math.random() * objects.length);
  if (firstobj > objects.length - 1) {
    firstobj = 0
      }
  currentSet = objects[firstobj] + "/";
  if (currentSet == null) {
    currentSet = blocks;
  }
  working = eval(objects[firstobj]);
  if (working == null) {
    working = blocks;
  }
}
 
// this figures out how many images there are on the page
 
function ImageCount(numOimages) {
  cellNum = numOimages - 1;
}
 
// This is called to draw out the page.
 
function screenDraw() {
  this.document.open();
  this.document.writeln('<div align="center"><nobr>');
  first();
  for (x=0; x < screenRows; x++) {
    for (y=0; y < screenCols; y++) {
      newImage = Math.round(Math.random() * (working.length - 1));
      document.writeln('<img src="' + basedir + imagedir + working[newImage] 
+ '" width="16" height="16" border="0">');
    }
    document.writeln('<br>');
  }
  document.writeln('</div></nobr>');
  //soundDraw();
  //userControls();
  this.document.close();
  ImageCount(document.images.length);
  //EmbedCount(document.embeds.length);
 
}
 
// Now that we are done with all the conditionals, let's get to the fun 
part.
 
// This function is the meat of it.  It randomly changes the image array
// and calls the other functions (sound) that are associated with it.
 
function imageMagic() {
  changeCell = Math.round(Math.random() * cellNum);
  newImage = Math.round(Math.random() * (working.length - 1));
  if (working[newImage] == null) {
    document.images[changeCell].src = basedir + "blank.gif";
  } else {
    document.images[changeCell].src = basedir + imagedir + working[newImage] 
+ ".gif";
    //      soundMagick(currentSet, working[newImage]);
  }
 
}
 
// This is the function that draws out the user controls
 
function userControls() {
  //  for (uc=0; uc < objects.length; uc++) {
  //document.write('<a href="javascript:void(0);" onMouseOver="setChange('' 
+ objects[uc] + '')"> ' + objects[uc] + ' </a>');
  //}
}
 
// This is the function that "bleeds" one array into the other.  It takes 
the
// current array and the next array that was chosen and randomly ads and 
takes
// away array elements until the array only contains one set of objects.
 
function setChange(newSet) {
  currentSet = newSet + '/';
  working = eval(newSet);
}
 
// this function shuffles the array.  I don't want things to always bleed,
// the same way.
 
// this function loops the image sections.
 
function keepGoing() {
  for (z=0; z < screenRows; z++) {
  imageMagic();
  }
  timeoutID=setTimeout("keepGoing()", 10);
}
</SCRIPT>
 
<META content="MSHTML 6.00.2800.1555" name=GENERATOR></HEAD>
<BODY text=#ffffff vLink=#ffffff aLink=#ffffff link=#ffffff bgColor=#000000
onload=Start();>
<SCRIPT>
screenDraw();
 
</SCRIPT>
 
<DIV align=center>&nbsp;&nbsp;&nbsp; <A onmouseover="setChange('binary')"
href="javascript:void(0);"><IMG src="Fig01-01_files/on.gif"
border=0></A>&nbsp;&nbsp;&nbsp; <A onmouseover="setChange('blocks')"
href="javascript:void(0);"><IMG src="Fig01-01_files/all.gif"
border=0></A>&nbsp;&nbsp;&nbsp; <A onmouseover="setChange('dots')"
href="javascript:void(0);"><IMG src="Fig01-01_files/red.gif"
border=0></A>&nbsp;&nbsp;&nbsp; <A onmouseover="setChange('letters')"
href="javascript:void(0);"><IMG src="Fig01-01_files/a.gif"
border=0></A>&nbsp;&nbsp;&nbsp; <A onmouseover="setChange('motion')"
href="javascript:void(0);"><IMG src="Fig01-01_files/right.gif"
border=0></A>&nbsp;&nbsp;&nbsp; </DIV></BODY></HTML>
 
 

 animato della pagina seguente?grazie e ciao
cut ...
 
Installati apache in locale, è facile e più che sufficiente
Trovi migliaia di guide che ti spiegano come farlo passo passo per 
qualsiasi piattaforma
Ciao
 
 
 
-- 
I fatti mi cosano