// ActiveVRML 1.0 ASCII use "lib.avr"; use "bitmap.avr"; /*****************************************************************************\ * * The background * \*****************************************************************************/ backBitmap = bitmapFromImport(import("back.gif")); backImage = imageOf(backBitmap); backXSize = xsizeOf(backBitmap); backYSize = ysizeOf(backBitmap); /*****************************************************************************\ * * Blinking stars on the background * \*****************************************************************************/ brightImage = first(import("bright.bmp")); dimImage = first(import("dim.bmp")); starImage(x, y, delay) = let s0 = dimImage until after(delay) => function(x) . s1; s1 = brightImage until after(0.25) => function(x) . s0; in transformImage( translate( x * backXSize, y * backYSize ), s0 ); starsImage = starImage( 0.9 , 0.1 , 5) over starImage(-0.8 , -0.8 , 6) over starImage(-0.1 , 0.75, 9) over starImage( 0.25, 0.9 , 10); /*****************************************************************************\ * * The title letters * \*****************************************************************************/ titleImage = let titlePos = vector2Xy(-0.5 * backXSize, 0.6 * backYSize); images = [ first(import("title0.gif")), first(import("title1.gif")), first(import("title2.gif")), first(import("title3.gif")), first(import("title4.gif")), first(import("title5.gif")), first(import("title6.gif")), first(import("title7.gif")), first(import("title8.gif")), first(import("title9.gif")) ]; zoomImage = let number = (0.5 - cos((time - 1) * pi / 2.2) / 2); in transformImage( translate(titlePos * number) o scale2(number), nth(images, 0) ); glowImage = let index = sin(time * pi * 2 / 3.56 - pi / 2) * 4.99 + 5; in nth(images, index); image = if (time < 1) then emptyImage else if (time < 3.2) then zoomImage else transformImage( translate(titlePos), glowImage ); in image; titleIn = first(import("titleIn.wav")); titleLoop = loop(gain(0.9, first(import("loop2.wav")) )); titleSound = (silence until after(1) => function(x) . titleIn) mix (silence until after(1.75) => titleLoop); /*****************************************************************************\ * * Button swoosh animation * \*****************************************************************************/ swooshImage(link, motionImage, xsize, xend, yend, delay) = let number = time * 4; maxSize = (backXSize + xend + xsize) / 2; midPoint = (-backXSize + xend + xsize) / 2; stretchIn(number) = transformImage( translate( interpolate(-backXSize, midPoint, number), yend ) o scale(number * maxSize / xsize + 0.01, 1), motionImage ); shrinkIn(number) = transformImage( translate( interpolate(midPoint, xend, number), yend ) o scale( interpolate(maxSize / xsize, 1, number), 1 ), motionImage ); static = hyperlink2( link, transformImage( translate(xend, yend), motionImage ) ); image = if (number < 1) then stretchIn(number) else if (number < 2) then shrinkIn(number - 1) else static; sound = first(import("schwoop.wav")); in (emptyImage, silence) until after(delay) => function(x) . (image, sound); /*****************************************************************************\ * * The buttons * \*****************************************************************************/ tutorialBitmap = import("tbutton.bmp"); pbackXSize(x) = (x / 460 - 0.5) * backXSize * 2; pbackYSize(y) = (0.5 - y / 256) * backYSize * 2; (tutorialImage, tutorialSound) = swooshImage( "earth.htm", first(import("tutor1.gif")), xComponent(second(import("tutor.gif"))), pbackXSize(274), pbackYSize( 54), 3.5 ); (introductionImage, introductionSound) = swooshImage( "avrml001.htm", first(import("intro1.gif")), xComponent(second(import("intro.gif"))), pbackXSize(138), pbackYSize(112), 5.0 ); (referenceImage, referenceSound) = swooshImage( "avrml002.htm", first(import("refer1.gif")), xComponent(second(import("refer.gif"))), pbackXSize(193), pbackYSize(173), 6.5 ); (samplesImage, samplesSound) = swooshImage( "samples.htm", first(import("samp1.gif")), xComponent(second(import("samp1.gif"))), pbackXSize(308), pbackYSize(220), 8.0 ); modelSound = tutorialSound mix introductionSound mix referenceSound mix samplesSound mix titleSound; /*****************************************************************************\ * * composite all the images * \*****************************************************************************/ modelImage = tutorialImage over introductionImage over referenceImage over samplesImage over titleImage over starsImage over backImage; model = (modelImage, modelSound, modelSound);