Glimmr Canvas Animation
version 1/111030 by Erik Temple
Chapter - Common code for animation rules
Last animation rule for an animation track (called the track):
advance the track.
To advance (track - an animation track):
[say "current frame: [current-frame]; cycles completed: [cycles completed of the track].";]
if the track is cycling:
let cyclic-frame be current-frame of the track - (cycle-length of the track * cycles completed of the track);
[say "Comparing cyclic frame ([cyclic-frame]) to cycle length ([cycle-length of the track]).";]
if the cyclic-frame > the cycle-length of the track:
increment cycles completed of the track;
if (current-frame of the track > animation-length of the track) and the animation-length of the track is not the cycle-length of the track:
cease animating the track;
if current-frame of the track > animation-length of the track:
cease animating the track.
To cease animating (track - an animation track):
now the animation-flag of the track is g-inactive;
unless the animation-callback of the track is "":
say the animation-callback of the track;
say run paragraph on;
unless animation is queued:
stop the Glulx timer.