Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Manually activating and deactivating tracks

    An animation track can be turned on or off manually using the following phrases. The most likely use for this functionality is to pause and restart one track while other animations are running.

        activate <track>
        deactivate <track>

    Note that the timer must *also* be running for a track so activated to actually run. We can find out whether any of our animation tracks is flagged as active by using:

        if animation is queued...

    We can test whether a *given track* is currently active by looking at its "animation-flag" property, which can be either "g-active" or "g-inactive":

        if the animation-flag of the default track is g-active...

    If we need to, we can ask whether there are any *currently running* animations, using this phrase:

        if animation is underway...

    This will return true only if an animation is flagged as active *and* the timer is running.

    We can change the speed of an animation once it is already underway:

        time <track> at <interval> milliseconds

    This should *only* be done when the animation is already running. It will adjust the global timer to utilize the newly selected speed.

    Another useful phrase is "cease animating <track>", which like "deactivate <track>", will immediately stop the indicated track. However, the latter merely stops the track, while the former also fires the callback of the track that was stopped. For example, if Track A moves an object to a given point while Track B cycles through a short sequence, we could use either phrase to as a callback on Track A to stop Track B. However, only the "cease animating" phrase will also fire Track B's callback:

        Track A is an animation track. The animation-callback is "[@ cease animating Track B]".
        Track B is an animation track. The animation-callback is "All done."