Creating ActiveVRML animations Creating ActiveVRML animations
This page describes how you can quickly write and run your own ActiveVRML scripts. We recommend you get started by looking at the examples we provide.
The primary tool we currently use for directly writing ActiveVRML content is a program called the "repl", standing for "Read-Evaluate-Print-Loop", similar to the REPL's in other interpreted languages. The repl allows ActiveVRML expressions to be evaluated, and allows an environment to be built up.
As such, it's very useful for exploratory, incremental programming - determining the types of expressions, using partial results in subsequent expressions, etc.
The user may type declarations such as
myGeo = geo1 union geo2;;
directly. Note that two semicolons are required after each piece of input to the repl.
Also, the repl supports a number of useful "directives" preceded with #:
- #setdir <pathname>;; -- set the current working directory. Example: #setdir "c:\mydir";;
- #use <filename>;; -- load a file into the environment being built up in the repl. Identifiers in the filename will then be available. Example: #use "foo.avr"
- #add <str>,<id>;; -- add the id to the list of behaviors being sampled and displayed. Example: #add "cool", model;;
- #eval <expression>;; -- directly evaluate an ActiveVRML expression. Example: #eval 1 + 2;;
- #delete <str>;; -- remove the id from the list. Example: #delete "cool"
- Ctrl-C -- to exit the repl.
Using the Repl
Down loading sample AVR files:
Copy to your local drive the entire \Samples directory from \\ACTGFX\ACTIVE
Place your local samples directory anywhere you want.
This directory will copy several AVR files (*.avr) and some resources needed. AVR files contain the actual code that gets interpreted by the engine via the Repl.
Loading an AVR file into the Repl can be done from a DOS box by typing : repl <filename.avr> The repl is located in "\Program Files\Plus!\Microsoft Internet\A-vrml".
The Repl window looks like a DOS command window with a > prompt. At the beginning of every session you'll get a typical "Welcome to ActiveVRML " message on your window.
ActiveVRML is an interpreted language so there is no need to compile your scripts. You can also directly type AVR code at the prompt and work with the repl interactively.
Load the model by typing: #add "cool", model;;
IMPORTANT: Always type 2 semicolons after every # command
This command tells the repl to sample the variable 'model' and assigns a tag called "cool".
The general syntax for #add is:
#add <any quoted string>,< identifier>;;
where the identifier is a variable defined in the avr file
To Terminate sampling:
- At the > prompt type:
#delete <quoted string>;;
Make sure the string matches the one you used for the #add
To exit the Repl:
At the > prompt hit Ctrl+C
Sample Repl session
The following is a sample repl session that displays a somewhat interesting image animation. The user types the bold lines. The others are response lines.
Welcome to ActiveVRML version 1.0.
> redIm = solidColorImage(red);;
redIm : () (image)
> w = 0.004 + 0.004 * abs(sin(time));;
w : () (number)
> w2 = w * 2;;
w2 : () (number)
> blueIm = crop(point2Xy(-w,-w),
point2Xy(w,w),
solidColorImage(blue));;
blueIm : () (image)
> model = tile(point2Xy(-w2,-w2),
point2Xy(w2,w2),
blueIm)
over redIm;;
model : () (image)
> #add "mine", model;;
(At this point, a window comes up and starts displaying the image behavior)
Note here that after every expression evaluation, the system prints out the type of the expression. Also, #add only supports certain types. Currently, #add supports only image, image*sound, and image*sound*sound types. To view a geometry, you must use "renderedImage" to render it into an image, and then #add the image.
Documentation
We have a tutorial and a full spec reference in our Website that you can consult for more details on how to write content.
Reporting Problems and Support
Please send all your bug reports to EnriqueP or ToddFe. Please include your system configuration along with detailed steps to reproduce the problem.
Feature Requests and Suggestions
We welcome any feedback that you may have. Please send email to ColinC and cc. EnriqueP.