Abajo están las diez imágenes que usa el applet
T1.gif:
T2.gif:
T3.gif:
T4.gif:
T5.gif:
T6.gif:
T7.gif:
T8.gif:
T9.gif:
T10.gif:
Aquí está el applet en acción. Recuerda que puedes pulsar sobre el applet para parar y arrancar la animación.
El código de este ejemplo es incluso más sencillo que el del ejemplo anterior, que movía una imagen. Aquí está el código que difiere del ejemplo que movía una imagen:
. . .//Where instance variables are declared:
Image duke[10];
. . .//In the init() method:
for (int i = 1; i <= 10; i++) {
images[i-1] = getImage(getCodeBase(),
"../../../images/duke/T"+i+".gif");
}
. . .//In the update() method, instead of calling drawFrame():
offGraphics.drawImage(images[frameNumber % 10], 0, 0, this);