Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Usage examples

    Here are a couple of examples of custom animation rules, and the code needed to set them up.

    This code produces a timer that counts the seconds in the status bar.

        The timer display is an animation track.

        Seconds elapsed is a number variable.

        When play begins:
            now the right hand status line is "s: [seconds elapsed]";
            animate the timer display as a custom animation at 1 frame per second, cycling.

        Animation rule for the timer display:
            increase the seconds elapsed by 1;
            now the right hand status line is "s: [seconds elapsed]";
            update the status line;
            advance the timer display.

        To update the/-- status line:
            (- if (gg_statuswin) DrawStatusLine(); -)


    This code simply counts down (silently) to a desired real-time event.

        The countdown is an animation track.
        The animation-callback of the countdown is "Kablooie!".

        When play begins:
            say "The bomb will go off in 180 seconds.";
            animate the countdown as a custom animation at 1 frame per second with a duration of 180 frames.

        Animation rule for the countdown:
            advance countdown.