Adobe atmosphere builder 1 ユーザーズマニュアル

ページ / 84
62
Creating effects with JavaScript
Using the Atmosphere JavaScript API
The Atmosphere JavaScript API comprises a set of modules that cover a broad range of 
functionality—from adding buttons to the Atmosphere Browser to applying transforma-
tions to an object. The following topics describe some of the things you can do with the 
Atmosphere JavaScript API.
Note: The Atmosphere JavaScript API is under continual development. For the most up-to-
date information, see Atmosphere JavaScript API documentation. This documentation is 
installed with Atmosphere Builder and is accessible from the Atmosphere folder in the 
Windows Start menu.
Adding sound
The Sound module provides methods and properties for implementing sound effects in a 
world. You can add both ambient and positional sounds to a world. An ambient sound is 
one that emanates from the entire world; while a positional sound is tied to a static or 
dynamic position in the world. For example, you can write a script that plays a creaking 
sound when a user navigates into a given position in the world. 
Atmosphere supports WAV format and MP3 format for sound effects. For example, the 
following code adds a sound and defines its parameters:
sound = Sound("soundName.wave");
sound.volume = .5 // volume
sound.repeats=0 // loop sound
sound.active=true // turn sound on
For more information on the Sound module, see the Atmosphere JavaScript API 
documentation.
Adding fog
The FogModel module provides methods and properties for implementing fog effects in 
a world. Fog is an atmospheric effect that obscures objects in relation to the position of the 
user. For example, you can write a script that creates a greenish-gray fog that falls within 
10 feet of the user’s position. 
Note: In many cases, adding fog to a world slows down the rendering. However, in the case of 
highly complex worlds, it can speed up rendering if the far point of the fog (beyond which 
things are completely obscured) is close enough to cull out substantial portions of the world.
atmosphere.book  Page 62  Wednesday, March 21, 2001  6:14 PM