home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / 3d / irit / scripts / animdemo.irt < prev    next >
Encoding:
Text File  |  1995-02-20  |  1.7 KB  |  75 lines

  1. #
  2. # Simple animation demo
  3. #
  4. #            Zvika Zilberman and Haggay Dagan
  5. #
  6.  
  7. save_mat = view_mat;
  8. save_res = resolution;
  9.  
  10. view_mat = view_mat * sc( 0.1 );
  11. viewobj( view_mat );
  12.  
  13. a = box( vector( 0, 0, 0 ), 1, 1, 1 );
  14. b = box( vector( 0, 0, 0 ), 1, 1, 1 );
  15. c = box( vector( 0, 0, 0 ), 1, 1, 1 );
  16. d = sphere( vector( 0, 0, 0), 0.7 );
  17.  
  18. pt0   =  ctlpt( e1,  0.0 );
  19. pt1   =  ctlpt( e1,  1.0 );
  20. pt2   =  ctlpt( e1,  2.0 );
  21. pt6   =  ctlpt( e1,  6.0 );
  22. pt360 =  ctlpt( e1,  360.0 );
  23.  
  24. pt10 = ctlpt( e1, -4.0 );
  25. pt11 = ctlpt( e1,  1.0 );
  26. pt12 = ctlpt( e1,  4.0 );
  27. pt13 = ctlpt( e1, -1.0 );
  28.  
  29. visible = creparam( cbezier( list( pt10,  pt11 ) ), 0.0, 5.0 );
  30. mov_x   = creparam( cbezier( list( pt0, pt6, pt2 ) ), 0.0, 1.2 );
  31. mov_y   = mov_x;
  32. mov_z   = mov_x;
  33. rot_x   = creparam( cbspline( 2,
  34.                               list( pt0, pt360, pt0 ),
  35.                               list( KV_OPEN ) ),
  36.                     1.2, 2.5 ); 
  37. rot_y   = rot_x;
  38. rot_z   = rot_x;
  39. scl     = creparam( cbezier( list( pt1, pt2, pt1, pt2, pt1 ) ),
  40.                     2.5, 4.0 );
  41. scl_x   = scl;
  42. scl_y   = scl;
  43. scl_z   = scl;
  44. mov_xyz = creparam( circle( vector( 0, 0, 0 ), 2.0 ), 4.0, 5.0 );
  45.  
  46. attrib( d, "animation", list( mov_xyz, visible ) );
  47. free( visible );
  48.  
  49. visible = creparam( cbezier( list( pt12,  pt13 ) ), 0.0, 5.0 );
  50.  
  51. attrib( a, "animation", list( rot_x, mov_x, scl, scl_x, visible ) );
  52. attrib( b, "animation", list( rot_y, mov_y, scl, scl_y, visible ) );
  53. attrib( c, "animation", list( rot_z, mov_z, scl, scl_z, visible ) );
  54.  
  55. color( a, red );
  56. color( b, green );
  57. color( c, blue );
  58. color( d, cyan );
  59.  
  60. demo = list( a, b, c, d );
  61.  
  62. interact( demo );
  63. viewanim( 0, 5, 0.01 );
  64.  
  65. save( "animdemo", demo );
  66.  
  67. free( a );
  68. free( b );
  69. free( c );
  70. free( d );
  71. free( demo );
  72.  
  73. resolution = save_res;
  74. view_mat = save_mat;
  75.