177 lines
5.2 KiB
HTML
177 lines
5.2 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
|
|
<BODY LEFTMARGIN=0 TOPMARGIN=0 BGCOLOR="#FFFFFF">
|
|
<FONT FACE="ARIAL" COLOR="BLACK">
|
|
<IMG SRC="hcreate.GIF" ALT="Internet Development Technologies">
|
|
|
|
<BLOCKQUOTE>
|
|
<TITLE>Creating ActiveVRML animations </TITLE>
|
|
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
<CENTER>
|
|
<H3>Creating ActiveVRML animations <P></H3>
|
|
</CENTER>
|
|
|
|
<P>
|
|
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.
|
|
<P>
|
|
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.
|
|
<P>
|
|
As such, it's very useful for exploratory, incremental programming
|
|
- determining the types of expressions, using partial results
|
|
in subsequent expressions, etc.
|
|
<P>
|
|
The user may type declarations such as
|
|
<P>
|
|
myGeo = geo1 union geo2;;
|
|
<P>
|
|
directly. Note that two semicolons are required after each piece
|
|
of input to the repl.
|
|
<P>
|
|
Also, the repl supports a number of useful "directives"
|
|
preceded with #:
|
|
<UL>
|
|
<LI>#setdir <pathname>;; -- set the current working directory. Example: #setdir "c:\mydir";;
|
|
<LI>#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"
|
|
<LI>#add <str>,<id>;; -- add the id to the list of
|
|
behaviors being sampled and displayed. Example: #add "cool", model;;
|
|
<LI>#eval <expression>;; -- directly evaluate an ActiveVRML expression. Example: #eval 1 + 2;;
|
|
<LI>#delete <str>;; -- remove the id from the list. Example: #delete "cool"
|
|
<LI>Ctrl-C -- to exit the repl.
|
|
</UL>
|
|
|
|
<P>
|
|
|
|
<H2>Using the Repl</H2>
|
|
|
|
<P>
|
|
<B>Down loading sample AVR files:</B>
|
|
<P>
|
|
Copy to your local drive the entire \Samples directory from
|
|
\\ACTGFX\ACTIVE
|
|
|
|
<P>
|
|
Place your local samples directory anywhere you want.
|
|
<P>
|
|
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.
|
|
<P>
|
|
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". <P>
|
|
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.
|
|
<P>
|
|
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.
|
|
<P>
|
|
|
|
Load the model by typing:
|
|
|
|
#add "cool", model;;
|
|
<P>
|
|
IMPORTANT: Always type 2 semicolons after every # command
|
|
<P>
|
|
This command tells the repl to sample the variable 'model' and
|
|
assigns a tag called "cool".
|
|
<P>
|
|
The general syntax for #add is:
|
|
<P>
|
|
#add <any quoted string>,< identifier>;;
|
|
<P>
|
|
where the identifier is a variable defined in the avr file
|
|
<P>
|
|
<B>To Terminate sampling:</B>
|
|
<OL>
|
|
<LI>At the > prompt type:
|
|
</OL>
|
|
|
|
<P>
|
|
#delete <quoted string>;;
|
|
<P>
|
|
Make sure the string matches the one you used for the #add
|
|
<P>
|
|
<B>To exit the Repl:</B>
|
|
<P>
|
|
At the > prompt hit Ctrl+C
|
|
<H2>Sample Repl session</H2>
|
|
|
|
<P>
|
|
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.
|
|
<P>
|
|
<TT>Welcome to ActiveVRML version 1.0.</TT>
|
|
<P>
|
|
<TT><B>> redIm = solidColorImage(red);;</B></TT>
|
|
<P>
|
|
<TT>redIm : () (image)</TT>
|
|
<P>
|
|
<TT><B>> w = 0.004 + 0.004 * abs(sin(time));;</B></TT>
|
|
<P>
|
|
<TT>w : () (number)</TT>
|
|
<P>
|
|
<TT><B>> w2 = w * 2;;</B></TT>
|
|
<P>
|
|
<TT>w2 : () (number)</TT>
|
|
<P>
|
|
<TT><B>> blueIm = crop(point2Xy(-w,-w),</B></TT>
|
|
<P>
|
|
<TT><B> point2Xy(w,w),</B></TT>
|
|
<P>
|
|
<TT><B> solidColorImage(blue));;</B></TT>
|
|
<P>
|
|
<TT>blueIm : () (image)</TT>
|
|
<P>
|
|
<TT><B>> model = tile(point2Xy(-w2,-w2),</B></TT>
|
|
<P>
|
|
<TT><B> point2Xy(w2,w2),</B></TT>
|
|
<P>
|
|
<TT><B> blueIm)</B></TT>
|
|
<P>
|
|
<TT><B> over redIm;;</B></TT>
|
|
<P>
|
|
<TT>model : () (image)</TT>
|
|
<P>
|
|
<TT><B>> #add "mine", model;;</B></TT>
|
|
<P>
|
|
(At this point, a window comes up and starts displaying the image
|
|
behavior)
|
|
<P>
|
|
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.
|
|
<H2>Documentation</H2>
|
|
|
|
<P>
|
|
We have a
|
|
<A HREF=earth.htm> tutorial </A> and a
|
|
<A HREF=avrml.htm> full spec reference </A>
|
|
in our Website that you can consult for more details on how to write content.
|
|
<H2>Reporting Problems and Support</H2>
|
|
|
|
<P>
|
|
Please send all your bug reports to EnriqueP or ToddFe. Please
|
|
include your system configuration along with detailed steps to
|
|
reproduce the problem.
|
|
<H2>Feature Requests and Suggestions</H2>
|
|
|
|
<P>
|
|
We welcome any feedback that you may have. Please send email to
|
|
ColinC and cc. EnriqueP.
|
|
</BLOCKQUOTE>
|
|
</BODY>
|
|
</HTML>
|