home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 November / Macworld Nov ’95.toast / Education / xModels 2D and 3D / Tutorial Examples / Tutorial 6. Segmented Animation < prev    next >
Encoding:
Text File  |  1995-06-22  |  2.1 KB  |  53 lines  |  [TEXT/X_#9]

  1. ; Tutorial 6: Segmented Animations
  2. ;
  3. ; The animations in the previous tutorials each consist of a 
  4. ; single sequence of frames.  It is possible to create an
  5. ; animation that consits of two or more sequences of frames,
  6. ; sort of glued together.  I call each sequence of frames a
  7. ; segment of the animation.  For example:
  8.  
  9.      animate 15 15 15 15  ; Make an animation consisting of
  10.                           ; four sequences of 15 frames each,
  11.                           ; for a total of 60 frames.
  12.  
  13. ; As you can see, you just list the number of frames in 
  14. ; each segment.  These numbers don't have to be the same.
  15. ; Then, instead of using a single range of values such as
  16. ; "1:5", you use a multiple range such as "1:5:2:7:3".
  17. ; This specifies that the value should range from 1 to 5 
  18. ; during the first segment, then from 5 to 2 during the
  19. ; second segment, then from 2 to 7 during the third, then 
  20. ; from 7 to 3 during the fourth and final segment.
  21. ; Ordinarily, there should be as many colons as as there are
  22. ; sequences of frames.  (You can't have more.  If you have
  23. ; fewer, the last value will be used in all remaining
  24. ; segments.)
  25. ;
  26. ; Here, for example, is a square that moves along the four
  27. ; sides of a diamond during the four segments:
  28.  
  29.     blacksquare  translate  -9:0:9:0:-9,  0:9:0:-9:0
  30.  
  31. ; Sometimes you want an object to move continuously throughout
  32. ; two or more segments.  If you omit the number between two
  33. ; colons, the computer will "smooth over" the boundary 
  34. ; between the two segments.  For example:
  35.  
  36.     blackcircle xtranslate -9
  37.        rotate 0::::-360  ; Rotate once around the point (0,0)
  38.                          ; over the course of all four segments.
  39.                          ; (The rotation is clockwise because of
  40.                          ; the negative sign.)
  41.     circle scale 18   ; The black circle's center moves along
  42.                      ; this circle
  43.  
  44. ; Finally, here is a cute example of a square "morphing"
  45. ; into a smaller square:
  46.  
  47.     graypolygon 
  48.             -6:-2:-2:-2:-2, 6:2:2:2:2
  49.             6:6:2:2:2,      6:6:2:2:2
  50.             6:6:6:2:2,      -6:-6:-6:-2:-2
  51.             -6:-6:-6:-6:-2, -6:-6:-6:-6:-2
  52.  
  53.