Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Reel animation preset

    Section - Reel animation rule
    [The reel animation rule applies to either g-elements (sprites) or to g-canvases (background image). If you supply a graphics g-window to the "animate..." phrase, it will be remapped to the canvas shown in that window.]

    First animation rule for a reel animation track (called the track) (this is the default reel animation rule):
        let img be a figure name;
        let x be a number;
        let cyclic-frame be current-frame of the track - (cycles completed of the track * cycle-length of the track);
        if the track is animation-randomized:
            let x be a random number between 1 and the number of entries in the image-reel of the track;
        otherwise if the cycle-length of the track is not the number of entries of the image-reel of the track:
            let x be the easing of the track applied to the cyclic-frame and the cycle-length of the track and 1 and the number of entries of the image-reel of the track;
        otherwise:
            let x be cyclic-frame;
        if x is greater than the number of entries of the image-reel of the track:
            now x is the number of entries of the image-reel of the track;
        now img is entry (x) of the image-reel of the track;
        if the animation-target of the track is a g-element:
            now the image-ID of the animation-target of the track is img;
        otherwise if the animation-target of the track is a g-canvas:
            now the background image of the animation-target of the track is img;
        otherwise if the animation-target of the track is a graphics g-window:
            now the background image of the associated canvas of the animation-target of the track is img;
        #if utilizing animation debugging;
        say "[>console][CA]Processed frame [b][current-frame][/b][if track is cycling] (frame [cyclic-frame] of cycle [cycles completed of the track + 1])[end if] of [i][track][/i] as a reel track targeting [the animation-target of the track]. Image displayed: [img] (entry [x] of the reel)[if the cycle-length of the track is not the number of entries of the image-reel of the track], selected using the [easing of the track] (t: [cyclic-frame], d: [cycle-length of the track], b: [start-x of the track], c: [delta-x of the track])[end if].[<]";
        #end if.