Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Invocation phrases for motion preset

    [Specify movement by points, duration, and timer.]
    To animate (track - an animation track) as a motion animation targeting (targ - an object) and ending at (end pt - a list of numbers) at (interv - a number) with a/-- duration of/-- (len - a number) frame/frames, cycling:
        if cycling:
            now the track is cycling;
        otherwise:
            now the track is not cycling;
        now the start-x of the track is entry 1 of the origin of targ;
        now the start-y of the track is entry 2 of the origin of targ;
        now the delta-x of the track is (entry 1 of end pt) - start-x of the track;
        now the delta-y of the track is (entry 2 of end pt) - start-y of the track;
        now the animation-target of the track is targ;
        if the targ provides the property display status:
            now the display status of the targ is g-active;
        now the cycle-length of the track is len;
        set up track as motion with duration len;
        animate the track at interv[ ms per frame].
        
    [Specify movement by points, average velocity, and timer.]
    To animate (track - an animation track) as a motion animation targeting (targ - an object) and ending at (end pt - a list of numbers) at (interv - a number) with a/-- velocity of/-- (V - a number) --/unit/units, cycling:
        if cycling:
            now the track is cycling;
        otherwise:
            now the track is not cycling;
        now the start-x of the track is entry 1 of the origin of targ;
        now the start-y of the track is entry 2 of the origin of targ;
        now the delta-x of the track is (entry 1 of end pt) - start-x of the track;
        now the delta-y of the track is (entry 2 of end pt) - start-y of the track;
        [say "start-x: [start-x of the track]; start-y: [start-y of the track]; delta-x: [delta-x of the track]; delta-y: [delta-y of the track].";]
        let X be the square root of (delta-x of the track * delta-x of the track) + (delta-y of the track * delta-y of the track);
        [say "X: [X]; V: [V].";]
        let len be X / V;
        if len < 1, now len is 1;
        now the animation-target of the track is targ;
        if the targ provides the property display status:
            now the display status of the targ is g-active;
        now the cycle-length of the track is len;
        set up track as motion with duration len;
        animate the track at interv[ ms per frame].