Benutzung von picmovie.js
Movie ist eine Objektklasse, mit der man ein Bild zeitgesteuert durch andere Bilder ersetzen kann, also eine Art Stummfilmprojektor.

Die Einbindung von timer.js in das HTML-Dokument ist zwingend notwendig.

Funktionen von Movie-Objekten
Objekt erzeugen
new Movie(moviepicture,initialtimestep) kreiert ein neues Movie-Objekt und meldet es beim Timer an
moviepicture: Image-Objekt aus dem Dokument, welches als Filmleinwand benutzt werden soll
initialtimestep: Verzögerung nach dem Start-Befehl in Timer-Ticks
FunktionBedeutung
AddPicture(picture,time_step) Fügt ein Einzelbild an den Film an
picture: Image-Objekt
time_step: Anzeigedauer in Timer-Ticks
SetEventHandler(eventhandler) Setzt die Funktion, die bei Start oder Stop des Vorganges aufgerufen werden soll
Bei Start bekommt die Eventhandler-Funktion dann die Zahl 1, bei Stop 0 übergeben.
Stop() Film anhalten
Step() ein Bild weiterschalten
Continue() angehaltene Filmvorführung fortsetzen
Start(loop,running) Stummfilm starten
loop:
      0: einmaliger Durchlauf
      1: Endlosschleife
running:
      0: nur zurückspulen
      1: Vorführung starten


Quelltext von picmovie.js
/* (c) 2001 Ulrich Kritzner */

function Movie_TimerFunc()
{
  with (this)
  {
    if (current<count)
    {
      window.document.images[moviepicture].src=pictures[current].src;
      if (timestep>0)
        timestep=timesteps[current];
      current++;
    }
    else if (loop)
      Start(loop,timestep>0);
    else
    {
      timestep=0;
      if (this.EventHandler)
        this.EventHandler(0);
    }
  }
}

function Movie_Add_Picture(picture,time_step)
{
  with (this)
  {
    pictures[count]=picture;
    timesteps[count]=time_step;
    count++;
  }
}

function Movie_Set_Event_Handler(eventhandler)
{
  this.EventHandler=eventhandler;
}

function Movie_Stop()
{
  var oldrun=this.timestep;
  this.timestep=0;
  if (oldrun)
    if (this.EventHandler)
      this.EventHandler(0);
}

function Movie_Step()
{
  if (this.timestep<=0)
    this.TimerFunc();
}

function Movie_Continue()
{
  this.Stop();
  this.timestep=1;
  if (this.EventHandler)
    this.EventHandler(1);  
  u_timer_continue();
}

function Movie_Start(loop,running)
{
  this.Stop();
  if (running)
    this.timestep=this.initialtimestep;
  this.loop=loop;
  this.current=0;
  if (running)
  {
    if (this.EventHandler)
      this.EventHandler(1);
    u_timer_continue();
  }
}

function Movie(moviepicture,initialtimestep)
{
  this.Stop=Movie_Stop;
  this.Step=Movie_Step;
  this.Continue=Movie_Continue;
  this.Start=Movie_Start;
  this.TimerFunc=Movie_TimerFunc;
  this.AddPicture=Movie_Add_Picture;
  this.SetEventHandler=Movie_Set_Event_Handler;
  this.initialtimestep=initialtimestep;
  this.loop=1;
  this.count=0;
  this.moviepicture=moviepicture;
  this.pictures=new Array();
  this.timesteps=new Array();
  this.current=0;
  this.timestep=0;
  this.timeval=0;
  u_timer_add_object(this);
}