Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: Parameterized reel animation tracks

    A parameterized reel animation loops through a list of values and assigns those in turn to the chosen parameter. The types of values that can be passed as a parameters are given below; these include more or less all of the visually significant properties provided by Glimmr extensions.

        figure names
        glulx color values
        lists of numbers
        indexed texts
        lists of lists of numbers
        lists of lists of figure names
        real numbers

    To set up a parameterized reel, we must supply a list of values (the "reel") of the same type as the chosen parameter. For example, a reel of figure names targeting the image-ID property of a sprite will produce a result nearly identical to that of using a standard reel animation--a flipbook-like sequence of images. Our reel must be one of the predefined list properties of our track. Here are the names of those list properties, followed by the type of value associated with each.

        image-reel - figure names
        color-reel - glulx color values
        coordinates-reel - lists of numbers
        numerical-reel - numbers
        indexed-text-reel - indexed texts
        numerical-array-reel - list of lists of numbers
        image-array-reel - list of lists of figure names
        associated-objects-reel - objects
        scaling-reel - real numbers

    To invoke a parameterized reel animation:

        animate <track> as a parameterized reel animation targeting <chosen parameter/property> of <target> at <interval> with a duration of <length> frames, <cycling><randomized>

    If we wish, we may omit the duration, resulting in this variant phrasing:

        animate <track> as a parameterized reel animation targeting <chosen parameter/property> of <target> at <interval>, <cycling><randomized>

    If we do this, the duration will be set automatically to the number of entries in the reel that corresponds to the type of the property we've chosen. And if we set the "cycling" option when no duration has been set, the track will continue to repeat ad infinitum, or until stopped by another event (such as a callback from another track; see the section on callbacks).

    The entries in the reel list will be shown in order, unless we've set the "randomized" option, in which case an entry will be chosen at random from the reel for each frame. (We can of course include multiple mentions of the same entity to influence percentages; if value A is listed twice in the reel while value B is listed just once, then the chance that value A will be displayed is twice as great as the chance that value B will be.)

    Examples of usage:

    The position of the cursor in a bitmap-rendered string:
        The wandering cursor track is an animation track. The numerical-reel is {26, 25, 24, 24, 24, 25, 26, 27}.

        Well-Considered Phrase is a bitmap-rendered string. The text-string is "It was a dark and stormy...". The cursor is 27.

        To move cursor aimlessly:
            animate the wandering cursor track as a parameterized reel animation targeting the cursor of the Well-Considered Phrase at 6 fps, cycling.

    The position of a sprite, "teleporting" from location to location on the canvas:
        The teleporting track is an animation track. The coordinates-reel is { {10, 10}, {152, 45}, {345, 12}, {72, 72}, {0, 400} }.

        Bamff is a sprite. The origin is {330, 330}.

        To teleport:
            animate the teleporting track as a parameterized reel animation targeting the origin of Bamff at 2 fps.

    Showing different text strings randomly:
        The flashcard track is an animation track. The indexed-text-reel is {"Eat only meats!", "Capitalize on murder!", "Fleece your neighbor!", "Wear plaid!", "Treacle trickles!"}.

        The card is an image-rendered string. The text-string is "". The background tint is g-white.

        When play begins:
            animate the flashcard track as a parameterized reel animation targeting the text-string of the Card at 900 milliseconds per frame, randomized and cycling.

    Easing equations normally have no effect on parameterized reel tracks. However, see the section on standard reel tracks above for the use of easing to extend or contract the apparent timing of reel transitions.