Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
6.1 KiB

  1. // ActiveVRML 1.0 ASCII
  2. use "lib.avr";
  3. use "bitmap.avr";
  4. /*****************************************************************************\
  5. *
  6. * The background
  7. *
  8. \*****************************************************************************/
  9. backBitmap = bitmapFromImport(import("back.gif"));
  10. backImage = imageOf(backBitmap);
  11. backXSize = xsizeOf(backBitmap);
  12. backYSize = ysizeOf(backBitmap);
  13. /*****************************************************************************\
  14. *
  15. * Blinking stars on the background
  16. *
  17. \*****************************************************************************/
  18. brightImage = first(import("bright.bmp"));
  19. dimImage = first(import("dim.bmp"));
  20. starImage(x, y, delay) =
  21. let
  22. s0 = dimImage until after(delay) => function(x) . s1;
  23. s1 = brightImage until after(0.25) => function(x) . s0;
  24. in
  25. transformImage(
  26. translate(
  27. x * backXSize,
  28. y * backYSize
  29. ),
  30. s0
  31. );
  32. starsImage =
  33. starImage( 0.9 , 0.1 , 5)
  34. over starImage(-0.8 , -0.8 , 6)
  35. over starImage(-0.1 , 0.75, 9)
  36. over starImage( 0.25, 0.9 , 10);
  37. /*****************************************************************************\
  38. *
  39. * The title letters
  40. *
  41. \*****************************************************************************/
  42. titleImage =
  43. let
  44. titlePos = vector2Xy(-0.5 * backXSize, 0.6 * backYSize);
  45. images =
  46. [
  47. first(import("title0.gif")),
  48. first(import("title1.gif")),
  49. first(import("title2.gif")),
  50. first(import("title3.gif")),
  51. first(import("title4.gif")),
  52. first(import("title5.gif")),
  53. first(import("title6.gif")),
  54. first(import("title7.gif")),
  55. first(import("title8.gif")),
  56. first(import("title9.gif"))
  57. ];
  58. zoomImage =
  59. let
  60. number = (0.5 - cos((time - 1) * pi / 2.2) / 2);
  61. in
  62. transformImage(
  63. translate(titlePos * number)
  64. o scale2(number),
  65. nth(images, 0)
  66. );
  67. glowImage =
  68. let
  69. index = sin(time * pi * 2 / 3.56 - pi / 2) * 4.99 + 5;
  70. in
  71. nth(images, index);
  72. image =
  73. if (time < 1) then
  74. emptyImage
  75. else if (time < 3.2) then
  76. zoomImage
  77. else
  78. transformImage(
  79. translate(titlePos),
  80. glowImage
  81. );
  82. in
  83. image;
  84. titleIn = first(import("titleIn.wav"));
  85. titleLoop =
  86. loop(gain(0.9,
  87. first(import("loop2.wav"))
  88. ));
  89. titleSound =
  90. (silence until after(1) => function(x) . titleIn)
  91. mix (silence until after(1.75) => titleLoop);
  92. /*****************************************************************************\
  93. *
  94. * Button swoosh animation
  95. *
  96. \*****************************************************************************/
  97. swooshImage(link, motionImage, xsize, xend, yend, delay) =
  98. let
  99. number = time * 4;
  100. maxSize = (backXSize + xend + xsize) / 2;
  101. midPoint = (-backXSize + xend + xsize) / 2;
  102. stretchIn(number) =
  103. transformImage(
  104. translate(
  105. interpolate(-backXSize, midPoint, number),
  106. yend
  107. )
  108. o scale(number * maxSize / xsize + 0.01, 1),
  109. motionImage
  110. );
  111. shrinkIn(number) =
  112. transformImage(
  113. translate(
  114. interpolate(midPoint, xend, number),
  115. yend
  116. )
  117. o scale(
  118. interpolate(maxSize / xsize, 1, number), 1
  119. ),
  120. motionImage
  121. );
  122. static =
  123. hyperlink2(
  124. link,
  125. transformImage(
  126. translate(xend, yend),
  127. motionImage
  128. )
  129. );
  130. image =
  131. if (number < 1) then
  132. stretchIn(number)
  133. else if (number < 2) then
  134. shrinkIn(number - 1)
  135. else
  136. static;
  137. sound = first(import("schwoop.wav"));
  138. in
  139. (emptyImage, silence) until after(delay) => function(x) . (image, sound);
  140. /*****************************************************************************\
  141. *
  142. * The buttons
  143. *
  144. \*****************************************************************************/
  145. tutorialBitmap = import("tbutton.bmp");
  146. pbackXSize(x) = (x / 460 - 0.5) * backXSize * 2;
  147. pbackYSize(y) = (0.5 - y / 256) * backYSize * 2;
  148. (tutorialImage, tutorialSound) =
  149. swooshImage(
  150. "earth.htm",
  151. first(import("tutor1.gif")),
  152. xComponent(second(import("tutor.gif"))),
  153. pbackXSize(274),
  154. pbackYSize( 54),
  155. 3.5
  156. );
  157. (introductionImage, introductionSound) =
  158. swooshImage(
  159. "avrml001.htm",
  160. first(import("intro1.gif")),
  161. xComponent(second(import("intro.gif"))),
  162. pbackXSize(138),
  163. pbackYSize(112),
  164. 5.0
  165. );
  166. (referenceImage, referenceSound) =
  167. swooshImage(
  168. "avrml002.htm",
  169. first(import("refer1.gif")),
  170. xComponent(second(import("refer.gif"))),
  171. pbackXSize(193),
  172. pbackYSize(173),
  173. 6.5
  174. );
  175. (samplesImage, samplesSound) =
  176. swooshImage(
  177. "samples.htm",
  178. first(import("samp1.gif")),
  179. xComponent(second(import("samp1.gif"))),
  180. pbackXSize(308),
  181. pbackYSize(220),
  182. 8.0
  183. );
  184. modelSound =
  185. tutorialSound
  186. mix introductionSound
  187. mix referenceSound
  188. mix samplesSound
  189. mix titleSound;
  190. /*****************************************************************************\
  191. *
  192. * composite all the images
  193. *
  194. \*****************************************************************************/
  195. modelImage =
  196. tutorialImage
  197. over introductionImage
  198. over referenceImage
  199. over samplesImage
  200. over titleImage
  201. over starsImage
  202. over backImage;
  203. model = (modelImage, modelSound, modelSound);