# Light Box

This animation consists of both 2D and 3D graphical elements as well as a coordinated sound effect. Given the effects that it produces, this sample is quite compact. The media elements are only 15KB and the HTML file is 10KB. The animation is approximately 150 lines long in JScript, half of which are general and reusable utility functions.

The animation uses four motion paths that include two axes, an arc, and a spline. (press the left mouse button to see the annotations). Various images, with attached spotlights, travel back and forth, in a given duration, along these paths. The animated images include two green ovals, a sprite of a travelling car, and a rendered rotating 3D cube. The spot lights tilt gently towards the walls as they approach them.

A 3D room model with 5 walls underlies the 2D animation and is lit with the travelling spot lights as well as a stationary point light source. This is a good example of the 2D/3D interplay that is afforded by DirectAnimation's integrated media support; the motion paths and images are 2D elements while the spot lights and the cube are 3D elements.

An imported, looping audio clip is presented with dynamic gain and pan parameters. The travelling position along the Y axis is used to construct a gain between 1/2 and 1, while the point along the X axis is used to construct a pan between -1 and 1.