Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Motion animation preset

    Section - Motion animation rule
    [The motion animation rule applies to either g-elements or to g-windows. If you supply any other object (including a canvas) to the "animate..." phrase, Inform will print a run-time error (P10) indicating that the object does not have the requisite property.]

    First animation rule for a motion animation track (called the track) (this is the default motion animation rule):
        let cyclic-frame be current-frame of the track - (cycles completed of the track * cycle-length of the track);
        let xx be a number;
        let yy be a number;
        if the animation-target of the track provides the property endpoint:
            let xx be entry 1 of the endpoint of the animation-target of the track - entry 1 of the origin of the animation-target of the track;
            let yy be entry 2 of the endpoint of the animation-target of the track - entry 2 of the origin of the animation-target of the track;
        if the delta-x of the track is not 0:
            now entry 1 of the origin of the animation-target of the track is the easing applied to the cyclic-frame and the cycle-length of the track and the start-x of the track and the delta-x of the track;
        if the delta-y of the track is not 0:
            if the secondary easing of the track is not the null easing rule:
                now entry 2 of the origin of the animation-target of the track is the secondary easing applied to the cyclic-frame and the cycle-length of the track and the start-y of the track and the delta-y of the track;
            otherwise:
                now entry 2 of the origin of the animation-target of the track is the easing applied to the cyclic-frame and the cycle-length of the track and the start-y of the track and the delta-y of the track;
        if the animation-target of the track provides the property endpoint:
            now entry 1 of the endpoint of the animation-target of the track is entry 1 of the origin of the animation-target of the track + xx;
            now entry 2 of the endpoint of the animation-target of the track is entry 2 of the origin of the animation-target of the track + yy;
        #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 motion track targeting [the animation-target of the track], 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])[if the secondary easing of the track is not the null easing rule] and the [secondary easing of the track] (t: [cyclic-frame], d: [cycle-length of the track], b: [start-y of the track], c: [delta-y of the track])[end if]. Origin: {[entry 1 of the origin of the animation-target of the track], [entry 2 of the origin of the animation-target of the track]}.[<]";
        #end if.