Escolar Documentos
Profissional Documentos
Cultura Documentos
© 2006 Anark Corporation. Anark, Anark Client, Anark Studio, Anark Player and the Anark
logo are trademarks, and in certain jurisdictions, registered trademarks of Anark Corpora-
tion. All rights reserved. Windows, Windows Media, DirectX and ActiveX are either trade-
marks or registered trademarks of Microsoft Corporation in the United States and/or other
countries. Pentium is a trademark or registered trademark of Intel Corporation or its sub-
sidiaries in the United States and other countries. JavaScript is a trademark or registered
trademark of Sun Microsystems, Inc. in the U.S. or other countries. Adobe and Adobe Pho-
toshop are registered trademarks of Adobe Systems Incorporated in the United States and/
or other countries. Apple, Mac, Mac OS, QuickTime and Safari are trademarks or registered
trademarks of Apple Computer, Inc. Netscape is a registered trademark of Netscape Com-
munications Corporation in the United States and other countries. 3ds max, plasma and
cleaner are registered trademarks and Discreet is a registered trademark of Autodesk/Dis-
creet in the USA and/or other countries. Cinema 4D is a registered trademark of MAXON
Computer GmbH/MAXON Computer Ltd., in the United States and/or other countries
worldwide. Maya is a registered trademark of Alias Systems Corp in the United States and/
or other countries. OpenGL is a registered trademark of Silicon Graphics, Inc., in the
United States and/or other countries worldwide. Sony, the PlayStation, and the PS logo are
trademarks of Sony (the “Sony Marks”). LightWave 3D is a registered trademark of New-
Tek, Inc. Anark Studio uses Pixomatic Rendering Technology, Copyright® 2005 by RAD
Game Tools, Inc. Anark Studio contains paintlib code. paintlib is copyrighted by Ulrich
von Zadow and other contributors.
All other trademarks are the property of their respective owners. All rights reserved. This
software is confidential and is the property of Anark Corporation. It may not be redistrib-
uted under any circumstances. Use of the documentation and software are subject to the
Anark license agreement.
Version date: March 19, 2007
Anark Corporation
1434 Spruce Street
Suite 200
Boulder, CO 80302
303.545.2592
www.anark.com
Anark_Studio_User_Guide.book Page i Monday, March 19, 2007 10:34 AM
Table
of
Table of Contents Contents
i
Anark_Studio_User_Guide.book Page ii Monday, March 19, 2007 10:34 AM
Table of Contents
Table of Contents
Index 325
Table of Contents v
Anark_Studio_User_Guide.book Page vi Monday, March 19, 2007 10:34 AM
Table of Contents
1
Anark_Studio_User_Guide.book Page 2 Monday, March 19, 2007 10:34 AM
Anark_Studio_User_Guide.book Page 3 Monday, March 19, 2007 10:34 AM
User Reference
3
Anark_Studio_User_Guide.book Page 4 Monday, March 19, 2007 10:34 AM
Anark_Studio_User_Guide.book Page 5 Monday, March 19, 2007 10:34 AM
5
Anark_Studio_User_Guide.book Page 6 Monday, March 19, 2007 10:34 AM
Introduction
Introduction to Anark Studio
About this manual 1. From the Start menu, select Run. The
This manual is intended to introduce Run window will open.
you to version 4.0 of Anark Studio. It a. From the Run window, select the
provides installation instructions and Browse button. The Browse win-
detailed documentation of the Anark dow will open.
Studio interface. For other Anark
b. From the Browse window, select
product documentation, visit the Anark
your CD-ROM drive. The files on
Web site at:
the Anark compact disc should
http://www.anark.com/support. appear.
c. Double-click on the Anark Studio
Windows system setup file, Install.exe, to launch
requirements the installer. The setup program
Windows 2000 or Windows XP will now load.
2. Follow the instructions in the
Pentium®III processor @ 600 MHz (or
installer. After installation, Anark
better)
Studio will be available on the Start
256 MB of RAM or more menu.
Microsoft DirectX 7 or later
Configuring a computer
Windows Media® Player 7 or later running an international
installed version of Windows
Minimum of 224 MB of free disk space To use Anark Studio when you are
running an international version of
Note: Anark Studio supports three Microsoft Windows operating system,
rendering engines. If you want to you will need to set some specific
view Anark Media presentations Regional Options in the Control Panel.
using the OpenGL® renderer, then
you will need a graphics card that Note: These settings only need to be
supports OpenGL 1.2.1 or later. For configured on the computer that is
more information about the render- creating the presentation; viewers
ing options, see “Setting rendering can view Anark Media regardless of
options” on page 174. their Windows settings.
To configure Regional Options for
Installation instructions Windows 2000:
Anark Studio uses a standard setup 1. Click on Start > Settings > Control
wizard. The steps for installation are Panel > Regional Options.
simple: 2. Do one of the following:
Insert the Anark Studio compact disc • Click on the General tab and change
into the CD-ROM drive on your “Your locale (location)” to English
computer. The Anark Studio Installer (United States). Then click OK. This
should automatically launch. If it will automatically set the correct
doesn’t auto-launch, do the following: numbering properties.
• Click on the Numbers tab and versions of the following items: Tuto-
manually set the following values: rials, Sample Projects, Sample Assets,
- Set “Decimal symbol” to a period Documentation, Latest Behaviors, Script
(.). Reference, and Latest Exporters.
User Reference 7
Anark_Studio_User_Guide.book Page 8 Monday, March 19, 2007 10:34 AM
Introduction
Introduction to Anark Studio
the Online Assistant, which is available user community. Type your question
inside of Anark Studio and from the into the Question area, and then click
Support area of the Anark website. Search. You can find the knowledge base
Although the behaviors are not “guaran- at:
teed” to work, Anark is confident that http://www.anark.com/developer/
they are useful and represent a “value- knowledgebase.
add” to your projects.
If the author of the script wishes Technical support
to share their work, they should send The Support area of the Anark website
the script to support@anark.com or has links to the Anark Forum, Knowl-
post it on the Anark Forum at edge Base, and to the Studio Online
http://forum.anark.com. Assistant Palette. To learn more visit:
http://www.anark.com/products/
Anark community forum support.html.
Visit http://forum.anark.com to access
the Anark Community Forum. Anark If you don’t find the answer to your
Technical Support, Professional Services question on the support site, you can
and Content Development experts visit e-mail your question to:
the forums daily and will help answer support@anark.com.
your questions, plus fuel your creative
possibilities and productivity in Anark Providing feedback
Studio. Anark invites you to send your sugges-
tions and feature requests and to report
Anark knowledge base
any issues you may find with Anark
The knowledge base provides access to a
Studio by using the Send Feedback
large number of wiki-style short articles
option under the Help menu.
and FAQs that have been written by
Anark staff or by members of the Anark
9
Anark_Studio_User_Guide.book Page 10 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
Quick Definition
Instance - An instance is an object that
has been added to the scene.
User Reference 11
Anark_Studio_User_Guide.book Page 12 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
User Reference 13
Anark_Studio_User_Guide.book Page 14 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
User Reference 15
Anark_Studio_User_Guide.book Page 16 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
table lists how the keys affect the Setting program and project
currently selected tool. preferences
Currently Selected Tool Anark Studio allows you to set prefer-
Modi- Fit Edit Edit Edit Shad- ences for each project and for the appli-
fier Selecte Cam- Cam- Cam- ing cation itself. The application settings are
Key * d era era era Mode saved when you close the project so that
Pan Zoom Orbit Toggle the next time you open Anark Studio, it
Alt No Zoom Orbit Zoom No will use the same application settings.
key effect effect
Ctrl No Orbit Pan Pan No Setting application preferences
key effect effect
To set application preferences:
* The mouse must be inside the perimeter of the
Project window when you press the modifier key. Choose Edit > Application Preferences.
The Preferences dialog opens. In
Windows, the Application tab will be
selected.
General settings
Nudge Increment – Sets the increment by
which objects will be nudged when
User Reference 17
Anark_Studio_User_Guide.book Page 18 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
pressing the arrow keys on the keyboard. snaps to every tall tick. Low snaps to
Defaults to .01. For more information every numbered tall tick.
about using the arrow keys to nudge
objects, see “Shortcuts for setting proper-
ties for groups, models and text” on
page 97.
Snapping Range – Sets the number of
pixels within which an item on the
Timeline tab will snap to other items.
Defaults to 10. Timeline Snapping resolution can be set to
low, medium or high.
Default Interpolation – Specifies whether
Anark Studio will create keyframes with For information about scaling the Time-
Smooth interpolation (also referred to as line, see “Scaling the Timeline” on
Bezier interpolation) or Linear interpola- page 147.
tion. The interpolation of any existing Studio Renderer – Sets the rendering
keyframes will not be changed; however, preference for presentations when
the interpolation of any new keyframes viewed in Anark Studio’s Project
will be set to this value. The interpola- window. This setting can be used to see
tion of individual keyframes can also be how the different renderers will display
set using the Timeline menu. For more the content of the scene.
information about keyframes and inter-
polation, see “Controlling keyframe Auto – This is the recommended set-
interpolation” on page 157. ting. It tries the following sequence of
renderers and uses the first one that’s
Quick Definition available: DirectX, OpenGL, then Soft-
Keyframe - A keyframe controls the ware.
data for a property at a single moment
in time. At least two keyframes, each DirectX – Uses Microsoft DirectX® for
with different values, are needed for a rendering the scene. DirectX is a group
property to be animated. of technologies that enable Windows-
based computers to run multimedia
Timeline Snapping Grid – The checkbox applications. Fast frame rates are
specifies whether elements on the Time- possible with DirectX rendering.
line tab, including the Playhead, time-
OpenGL – Uses OpenGL for rendering
bars and keyframes, will snap to marks
the scene. OpenGL is a cross-platform
on the Time measure. The pull-down
standard for 3D rendering and 3D
menu lets you select the snapping reso-
hardware acceleration. Fast frame rates
lution. High snaps to every tick. Medium
are possible with OpenGL rendering.
Software – Specifies that software ren-
dering will be used. Software rendering
enables Anark Media to be played on
nearly all Windows computers; how-
ever, there are some limitations to soft-
ware rendering that should be
considered when using this option. See
User Reference 19
Anark_Studio_User_Guide.book Page 20 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
User Reference 21
Anark_Studio_User_Guide.book Page 22 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
User Reference 23
Anark_Studio_User_Guide.book Page 24 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
The Basic Objects tab contains a row of The Storage tab is a file repository that
buttons that allow you to add built-in lets you quickly access object files such
objects and primitives to your project. as 3D models, sounds, 2D graphics,
There are nine built-in resource object videos and behavior scripts that you
types: Component, Group, Text, Layer, may want to use in your project. It
Camera, Light, Behavior, Video and features folders for organizing objects by
Music. There are five primitive objects: type and a second pane to quickly access
Rectangle, Sphere, Cube, Cylinder and their contents.
Cone.
You can drag and drop items from the
Every time an item from the Basic Storage tab onto the Timeline or Project
Objects tab is dragged into the project, window, or you can add items to the
it’s added to the Library and therefore Library using the Add to Library button.
increases the finished file size. Whenever Items on the Storage tab are not
possible, it’s a good idea to reuse existing included in a project until you add
Library resources instead of continually them.
adding new resources. An exception to
this rule is text objects. Because they are Note: Text and components are not
not added to the Library, you must drag added to the Library, although the
instances from the Basic Objects tab objects inside a component are. For
each time, or otherwise copy or dupli- more information, see “How text is
cate them. For more information about added to the project” on page 54.
adding basic objects to your project, see
“Adding objects to the project” on Two default folders are included when
page 52. Anark Studio is installed: the Behavior
Library and Samples. You can add and someone else, you must edit the
delete folders, edit their names, etc. path to be relative and ensure that
they have the same directory struc-
Working with the Storage tab ture; otherwise, only their default
When you add a folder to the Storage folders will be displayed. For more
tab, it creates a dynamic link to a direc- information about specifying paths,
tory or file on your computer or see “Understanding paths for
network. If you rename, add, move or streaming media and dynamic
delete a file or directory from your images” on page 166.
computer or network, that change will
be reflected on the Storage tab. You can Note: If you add a directory to the
also refresh the Storage tab manually Storage tab from a network drive
during a session. that contains an extremely large
number of files, it may slow down
To add files to the Storage tab you must
the loading time of any Anark Stu-
either map an existing directory on your
dio presentation that includes that
computer to the Storage tab or add files
folder.
to a directory on your computer or
network that is already mapped to a To delete a folder:
folder on your Storage tab. 1. Select a folder.
To add a folder: 2. Click on the Palette menu button
1. Click on the Palette menu button ( ) and select Delete Folder. Delet-
( ) and select Add Folder. The Add ing a folder will not remove the files
Folder dialog box will open. from your hard drive or network. It
2. Select a name and a root directory for will only delete the Storage tab’s link
the folder. If you don’t type in a to the directory.
name, the directory’s current name 3. Click Yes.
will be used. To edit a folder:
3. If you want this directory to be avail- Click on the Palette menu button ( )
able for all your Anark Studio and select Edit Folder. Change any
projects, check “Create as default settings you want and click OK.
folder on application launch.” If you
want to use it for this project only, Adding objects from the Storage
leave it unchecked. tab to the project
4. Click OK. Files on the Storage tab can be added to
the Library or directly to the Project
All of the files, folders and subfolders window or Timeline (which automati-
within the root directory will be cally adds it to the Library, as well). This
included in the new folder on the only works for individual files, not
Storage tab. folders. While components are not
added to the Library, their contents are.
Note: When you initially add a direc-
tory to the Storage tab, the absolute To add a resource to the Library:
path is used. If you plan to share Do one of the following:
your project file (the .amw file) with Select the object file and click the Add
User Reference 25
Anark_Studio_User_Guide.book Page 26 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
The Library displays the name of each may also want to clean out the Library as
built-in and imported resource and the you are working on a project. There are
icon for its object type. These resources two ways to get rid of unused items in
serve as templates for the objects and the Library.
interactive behaviors that you add to the To delete a single resource from the
project (using the instructions in Library:
“Adding objects to the project” on 1. Select a resource in the Library.
page 52).
2. Do one of the following:
To rename items in the Library:
• Press the Delete key.
1. Select the item in the Library and
then double-click on the text of the • Right-click and select Delete Item
item’s name or press the F2 key. from the Context menu.
2. Type a new name and press Enter. If there is an instance of the resource in
the presentation, an error message will
Adding objects to the Library appear. If you still want to delete the
resource, you must first delete all
There are several ways to add items to
instances in the presentation and delete
the Library.
the resource again.
From the Storage tab using the Add to To delete all unused resources:
Library button. If the Library is on a With the mouse over the Library, right-
separate palette, items can also be click and select Delete Unused Resources
dragged onto the Library from the from the Context menu. Every resource
Storage palette. See “Adding objects that is not currently being used in the
from the Storage tab to the project” on scene will be deleted.
page 25 for more information.
From the Basic Objects tab by adding Accessing the Behavior Library
objects to the project. See “Adding When you are ready to start working
objects to the project” on page 52 for with behaviors, which create the interac-
more information. tivity of the scene, you can import any
of the common interactive behaviors
From the Library tab using the Import that are included in the Behavior Library
Resource menu item. See “Importing tab on the Storage tab or you can create
objects” on page 51 for more informa- your own.
tion.
A Behavior Reference HTML page that
Text cannot be brought into the Library. provides information about what each
For more information, see “How text is behavior does is easily accessible from
added to the project” on page 54. the Help menu or from the Online Assis-
tant (accessible from the Anark website).
Cleaning up the Library
As you add and remove objects from The Behavior Reference Library contains
your scene, the Library may get cluttered brief descriptions of each behavior and
with resources that aren’t being used. how they operate. Behaviors are sepa-
This can significantly increase the final rated into categories based on their func-
file size. Before you publish your project, tionality. The majority of behaviors have
you should clean out the Library. You
User Reference 27
Anark_Studio_User_Guide.book Page 28 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
Each object type has its own set of prop- Click on the box next to a property to
erties. The editable properties of behav- turn on only that Animation toggle.
iors are also displayed in the Inspector The Animation toggle must be turned on
when selected. in order to set keyframes for a property.
The Inspector features several types of For more information about the Anima-
parameter controls, such as pull-down tion toggle, see “Using the Animation
menus, sliders and numerical entry toggle” on page 146.
boxes. For added flexibility, the interface
User Reference 29
Anark_Studio_User_Guide.book Page 30 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
User Reference 31
Anark_Studio_User_Guide.book Page 32 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
User Reference 33
Anark_Studio_User_Guide.book Page 34 Monday, March 19, 2007 10:34 AM
Chapter 1
Anark Studio Overview
35
Anark_Studio_User_Guide.book Page 36 Monday, March 19, 2007 10:34 AM
Chapter 2
Preparing Models, Videos and Images
Tips for creating models, Avoid using a negative scale value for
materials and maps polygons. If any of the polygons in
When creating models in a 3D modeling your model have a negative scale
program or converting them from other value, they will be interpreted incor-
formats into AMX, these tips will help rectly in Anark Studio. If the model is
produce the best results. exported as an AMX file, the negative
values are retained and the polygons
Note: Because the Anark Maya AMX will appear black. If the model is
Exporter does not export texture exported as a 3DS file, Anark Studio
map data, you can ignore all guide- will turn the negative values into posi-
lines related to image maps. tive values.
It’s always a good idea to name all
General modeling guidelines and models, materials and maps.
best practices
Anark Studio limits a single model’s Important: Due to the parameters of
complexity to 65,000 vertices or the .3ds format, the name of a map
21,000 faces. All models must be can only be eight characters long
triangulated. (plus the three-character file exten-
sion). For example, if you applied a
If you want to apply any kind of texture named RockTexture.png to a
texture map in Anark Studio, your
model, you would have to rename it
model must have UV coordinates on it.
ROCKTEXT.PNG before exporting
If you apply any kind of bitmap image the model. The AMX format does
to a model, it will more than double not have this limitation.
the finished file size.
If you plan to apply video or bitmap
All bitmap images that have been images without color shifting, set the
applied to a model will import as Diffuse Color of the Material to White.
uncompressed bitmaps. If you want to
Quick Definition
reduce the file size, select the image in
Image Map - An image map is a 2D
the Library palette in Anark Studio and
graphic image that has been wrapped
set the desired compression using the
around a 3D object by mapping it to
Inspector. Setting compression levels
the object’s material. Some 3D model-
on one image will distribute the
ing applications refer to image maps as
settings to all instances of the image.
bitmaps, textures or texture maps.
See “Setting properties for images” on
page 104 for more information.
Guidelines for working in 3ds
As you work in a modeling program, max
create and edit your models in the To ensure that the units will be the
native format. Export them to .3ds or same in 3ds max and Anark Studio, set
.amx after they are completed. See the units to 1 inch in 3ds max. To
“Choosing a 3D program and export do this:
file format” on page 36 for more infor-
mation about deciding what file a. Pull down the File menu.
format to use.
User Reference 37
Anark_Studio_User_Guide.book Page 38 Monday, March 19, 2007 10:34 AM
Chapter 2
Preparing Models, Videos and Images
See “Preparing video clips and graphics Guidelines for exporting to .3ds
as image maps” on page 41 for more tips Be sure to use “eight dot three” file
on working with maps. names (eight-character name plus
three-character file extension) for all
Guidelines for working in maps and ensure these maps are in the
Cinema 4D same directory as the saved .3ds file.
Only pure polygon objects can be
If a bitmap has been applied to the
exported, so do not include any spline,
model (or if you intend to apply an
lathe, patch or other object types.
image to it in Anark Studio), it must
All polygon normals must be facing have UV coordinates on it and you
the proper direction. You can switch must check Preserve Texture Coordi-
on the Show Normals option to check nates in the Export dialog box.
that the normals are facing the proper
direction. Guidelines for exporting to .dae
Do not import 3ds files. They are not Geometry
interpreted correctly and thus will not All polygon geometry is supported.
export to the AMX format correctly.
NURBS and sub-division surfaces need
Guidelines for working in Maya to be tessellated first before they can be
If a model you are working on in Maya exported.
has a texture map applied to it, Maya
automatically sets the Shader diffuse Materials
color to black. When the model is Supported ColladaMaya material types:
brought into Anark Studio, the texture • Constant (flat shading)
map information is not imported and
• Blinn
the diffuse color is set to light gray.
• Phong
Only polygonal models will be
• Lambert
exported; NURBs (non-uniform
rational B-splines) and Subdivision Note: The shading types Blinn,
Surface models should be converted to Phong and Lambert are switched to
polygons before exporting. use Gouraud shading at the time of
Layered and Surface shaders are not conversion.
exported, although Anisotropic, Blinn,
Supported color types:
Lambert, Phong and PhongE shaders
are. • Diffuse
There is a 100:1 ratio of scale between • Ambient
Maya and Anark Studio units. Any • Specular
model that is created at a 1 unit size in Opacity, specular power, and emissive
Maya (such as any primitive model’s power are supported.
default size) will need to be scaled up
100 times to be seen in Anark Studio’s Material modes supported:
default viewport setting. • Solid
User Reference 39
Anark_Studio_User_Guide.book Page 40 Monday, March 19, 2007 10:34 AM
Chapter 2
Preparing Models, Videos and Images
User Reference 41
Anark_Studio_User_Guide.book Page 42 Monday, March 19, 2007 10:34 AM
Chapter 2
Preparing Models, Videos and Images
with certain video cards. If you decide Anark Studio. To successfully map the
to use dimensions that are not in video to the model in Anark Studio,
powers of 2, such as 210 x 112, during you need to delete the single-frame
playback, the graphics card will auto- image map attached to the model’s
matically rescale the image to 256 x material, import the .avi file directly
128, which can make the image appear into Anark Studio and reattach it to
fuzzy. Not using a power of two for the material. For more information
certain video types that are set to tile about working with video, see “Adding
may cause a black margin to appear streaming media files to a project” on
between the tiled images. page 167.
Try to limit image dimensions to less If the video will be mapped to a rect-
than 256 pixels in width and height to angle or square, you can maintain the
conserve Texture memory and band- aspect ratio while compressing the file
width for Internet broadcasts. from 320 x 240 (the standard setting)
down to 256 x 192 in order to improve
In general, you should import uncom-
performance. If the video will be
pressed images and then use the
mapped to an object with curves,
Compression Type, Compression
where it will already be distorted, it’s
Quality and Image Size Reduction
recommended that you compress it
settings in Anark Studio. Avoid
down to 256 x 256.
importing .jpg images because all
image files are recompressed in Anark Be judicious about the codecs and
Studio, which can inadvertently compression you choose to ensure that
increase the file size. See “Setting prop- the file sizes are only as large as needed
erties for images” on page 104 for more in order to conserve processor power
information. and bandwidth. For example, a Reflec-
tion Map can be highly compressed
For video clips, choose a compression
and the results will still be rendered
type that is suitable for your band-
well.
width. Compression Technologies’
CinepakPro™ (http:// When applying video or images
www.cinepak.com/) is known to work without color shifting, be sure to set
fairly well. the Diffuse Color of the Material to
White.
When an AVI is used as a map for a
material in 3ds max, only the first See “Map guidelines” on page 38 for
frame of the video is used as the map more information on applying images to
when the model is imported into models.
Preparing image files in Adobe 5. For the question “What image format
Photoshop would you like?” select “PNG.” Click
the Next button.
General settings 6. Use the browser window to select a
Anark Studio can only work with 8-bit name and location for the file.
per channel image files, which is the
default setting in Photoshop. If you have 7. Click OK.
changed the Photoshop file to the 16-bit For more information about using the
per channel mode, you will need to image as an Opacity Map, see “Creating
change it back to the 8-bit mode when an Opacity Map” on page 112.
you export it for Anark Studio. There
Quick Definition
should be no loss of quality when you
Alpha channel - An alpha channel is the
do this.
portion of an image’s data that specifies
To set a Photoshop file to 8-bit mode: the transparency of each pixel in the
Select Image > Mode > 8 Bits/Channel. image. Some popular image types, such
You can then export the image to the as JPEG, do not support alpha channel
file format you want to use in Anark data.
Studio.
User Reference 43
Anark_Studio_User_Guide.book Page 44 Monday, March 19, 2007 10:34 AM
Chapter 2
Preparing Models, Videos and Images
fix the problem, simply move the label b. Turn on Connect to Source by
slightly closer along the Z axis. checking the box.
I want to use an AVI video file in my project, c. Drag the Playhead.
but it won’t import, even though it’s listed as
a supported file type.
The video should now be displayed.
Anark Studio works with most, but not
all AVI files. Some video card manufac- 3ds max troubleshooting
turers create proprietary AVI codecs, When I import a model and drag it onto the
which Anark Studio may not be able to Project window, it doesn’t appear.
work with. There are several possibilities:
There’s a black border between tiled video The scale of the object may be so large
clips on a model. that the camera is actually inside it,
The video dimensions need to be set to a which means you won’t be able to see
power of two such as 8, 16, 32, 64, 128, it unless you move the camera or the
etc. object or you reduce the scale of the
When I apply an image to a material on an object.
imported model, only a single color is
applied.
Alternatively, the scale of the object
The model doesn’t have UV coordinates. may be so small that you can’t see it on
You must create UV coordinates for it in the screen. You can either increase the
your 3D modeling application and re- object’s scale or you can move the
import it or refresh the file. camera closer to the object.
When I drag a video resource onto a layer or In some cases, 3ds max may have
a material on a model, the object turns created an empty object (i.e., a node
black. Where’s the video? that doesn’t contain any geometry),
There are a couple of possibilities. which Anark Studio is unable to read.
Your video may have an unsupported Go back into 3ds max and view all the
bit depth. In Windows, only 32-bit objects in the file (the schematic view
depth video files will work. Video files and the Select Objects dialog box are
with other bit depths will not show up two options for doing this). Delete any
at all. object that does not contain geometry
that is visible in the scene, save the
The video may still be loading or Anark .3ds file and reimport it into Anark
Studio may not be connecting to the Studio.
resource properly. Large video files,
When I import a .3ds object, the models are
high resolution video and uncom- no longer in the same position in relation to
pressed video can all take a while to each other.
load. If the video takes longer than You must go back into 3ds max and reset
normal to appear, try the following: the Xform (Transform) and collapse the
a. Check to see if there is a Remote stack of each model before importing
Source for the video resource. This the object into Anark Studio. For
is the URL of the video file or the detailed instructions, see “Exporting
fully qualified absolute or relative models to .3ds” on page 41.
path to it.
User Reference 45
Anark_Studio_User_Guide.book Page 46 Monday, March 19, 2007 10:34 AM
Chapter 2
Preparing Models, Videos and Images
47
Anark_Studio_User_Guide.book Page 48 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
Understanding attachments
User Reference 49
Anark_Studio_User_Guide.book Page 50 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
Importing objects
User Reference 51
Anark_Studio_User_Guide.book Page 52 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
User Reference 53
Anark_Studio_User_Guide.book Page 54 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
The duration of added objects The start handle of the object’s timebar
With the exception of layers, sounds and is set to the current position of the
music, when an item is added to the Playhead.
project, its duration is set to match the
If the Playhead is currently located
duration of its parent object and the
before the parent object’s end handle,
item is automatically selected.
the end handle of the object being
The duration of the default layer in the added is matched to the end handle of
scene is initially set to 10 seconds. When the parent.
subsequent layers are added, their dura-
tion is also set to 10 seconds. If the Playhead is currently located
after the parent object’s end handle,
The duration of sounds and music is set the duration of the object’s timebar is
to the length of the data they contain. set to 10 seconds.
For example, a sound might have a dura-
tion of 2 seconds and a music file might
How text is added to the
have a duration of 4 minutes.
project
How the Ctrl key affects adding Text objects aren’t added to the Library.
objects In order to add new instances of text to a
Holding down Ctrl as you drag an object project, you must drag them from the
to the Project window or the Timeline Basic Objects palette each time. If you
has the following effects on the object’s want to keep the same property settings
timebar: for additional instances of text, you can
copy or duplicate an existing instance.
There are many factors that can affect To update all source files in the Library at
Anark Studio’s ability to work with once:
specific files. For more information Right-click anywhere in the Library and
about file limitations see “Working with select Refresh all Resources from the
exporter plug-ins” on page 40. Context menu.
User Reference 55
Anark_Studio_User_Guide.book Page 56 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
If the new source file contains addi- 1. An artist creates a re-usable compo-
tional models, the new models will be nent as its own presentation. All
added to both the Library and to any changes to the master component
instances of the group. need to occur in this file.
If the new source file had models 2. The artist exports the component to
deleted from it, those models will also disk as a standalone Anark Media
be deleted from the Library and from Component (.amc) file.
any instances of the group. If any of
3. The .amc file is imported into
those models were moved so that they
another presentation. Instances of
were attached to other objects instead
the component are positioned, ani-
of the original group, then those
mated, and otherwise customized in
instances will be deleted as well.
this presentation.
If you don’t refresh a file in Anark
4. When necessary, the master compo-
Studio, then even if you move or delete
nent presentation is changed, and
the source file, no changes will be made
the updated .amc file is re-exported
to the presentation.
to disk.
For information about working with
5. The artist using the component
streaming video and music, see “Chapter
selects the component in the Library
8: Working with Streaming Media and
palette and chooses Refresh from
Dynamic Images” on page 165. For
File. Anark Studio updates instances
information about adding instances of
of the component in the scene to use
objects to a project, see “Adding objects
the new changes, and preserves the
to the project” on page 52. For informa-
per-instance changes that the artist
tion about object attachments, see
previously made.
“Understanding attachments” on
page 49. Quickly finding a library item
To easily find and select the associated
Refreshing components in the Library asset, select the component in
project the Timeline and enter the keyboard
The Refresh File command allows you to shortcut Ctrl-L.
update multiple components within a
scene from a single .amc file. In order to Creating refreshable
refresh a component in a presentation, components
you right-click on the component in the A single presentation potentially calls for
Library palette and select Refresh File. many components that are similar, but
This feature allows large design teams to not the same. For example, there may be
distribute the work of creating reusable ten Menu buttons, and ten more
components, and facilitates collabora- Options buttons. These two button types
tion. are different enough to justify their own
master presentations and .amc files, but
Workflow similar enough that it would be redun-
Briefly, the steps you follow to use refre- dant to build both from scratch.
shable components are:
When you import a component with the At this point, the new project may
same GUID (but different file path) as be customized and the component
another component already in the inside it exported as an .amc file,
presentation, Anark Studio detects the with no danger of conflicting with
conflict and shows a dialog: the original component.
User Reference 57
Anark_Studio_User_Guide.book Page 58 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
sistent state. The presentation is not This action is different from just deleting
corrupt – there is no data loss – but is set all the instances and starting over,
up in a way that is explicitly prevented however. The values of properties on the
in brand new presentations. Refreshing outside of each instance are preserved
components in such a presentation may during a replace. This applies to standard
show Library assets that would normally properties (such as position, rotation,
be hidden. The update that occurs to scale, opacity, etc.) as well as any custom
those Library items affects scene properties the two components may
instances outside the component share.
sharing that Library item.
The only way to clean up such a presen- Copying and duplicating
tation (if it is deemed necessary) is to objects in the project
delete the items from the scene sharing There are three slightly different ways
the item, import a new copy of the item of copying an object: duplicating it,
into the Library, and re-add the scene copying it, and cutting and pasting it.
instances from that item.
All of these methods create an exact
duplicate of the original object. The
Replacing versus refreshing copy’s timebar remains its original
When using the Refresh File command length, and the copy will include any
for a component, it is possible to select actions, animation keyframes and child
an .amc file for a completely different objects.
component. When this occurs, the two
There are some minor differences
components are so wholly different that
between copying, duplicating, and
no per-instance artist changes are
cutting and pasting.
preserved. Instead, the component
instances are said to be “replaced” rather Duplicating makes a copy and auto-
than refreshed. matically attaches it to the same parent
Anark Studio detects such a situation as the original.
when the internal GUID for the new Copying allows you to select a
component does not match the GUID different object to copy it to.
for the Library item, or when a legacy
component is refreshed for the first time. Cutting deletes the original object
The following dialog is shown: until it is pasted.
Objects can be copied or cut and pasted
between concurrently running instances
of Anark Studio.
To duplicate an object:
1. Select an item in the Object outline
or the Project window.
If the artist selects OK, the contents of
each component instance in the scene 2. Do one of the following:
is replaced with instances of the new • Select Edit > Duplicate Object, or
component. This means that all per- press Ctrl + D. The duplicate will be
instance customizations are discarded. attached to the same parent as the
• While holding down Ctrl, drag it • Copy the object by selecting Edit >
onto the bar of the object in the Copy or pressing Ctrl + C.
Timeline tab to which you want it • Cut the object by selecting Edit >
attached. Cut Object or pressing Ctrl + X.
To copy an object in the presentation: 3. Launch a new instance of Anark Stu-
1. Select an item in the Object outline dio or switch to one that is already
or the Project window. running.
2. Do one of the following: 4. Select the object you want the copied
• Select Edit > Copy, or press Ctrl + C. object to be attached to.
• Right-click and select Copy Object 5. Do one of the following:
from the Context menu. • Select Edit > Paste Object or press
3. Do one of the following: Ctrl + V.
• Select Edit > Paste Object or press • Right-click on the name of the item
Ctrl + V. in the Object outline and select
• Right-click and select Paste Object Paste Object from the Context
from the Context menu. menu.
To cut and paste an object:
1. Select an item in the Object outline Duration of the project
or the Project window. The duration of a presentation is based
on the duration of the content within it.
2. Do one of the following:
To determine a project’s duration, the
• Select Edit > Cut Object, or press system looks for the last end handle of
Ctrl + X. the last layer and sets the duration of the
• Right-click on the name of the item project to that point.
in the Object outline and select Cut During playback, the content will be
Object from the Context menu. played from 0 seconds to the final end
3. Select the object you want the cut handle of the last layer. If the scene is set
object to be attached to. to loop, it will continuously loop
between those points. If the first layer’s
4. Do one of the following:
start time begins after 0 seconds, play-
• Select Edit > Paste Object or press back will begin with a blank screen at 0
Ctrl + V. seconds; and, even if the timebars of
• Right-click on the name of the item other objects extend past the last layer’s,
in the Object outline and select nothing past the last layer’s end handle
Paste Object from the Context will be displayed.
menu. There is no explicit limit on the duration
of a project. When a project is first
User Reference 59
Anark_Studio_User_Guide.book Page 60 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
Selecting objects
User Reference 61
Anark_Studio_User_Guide.book Page 62 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
Renaming objects
To expand or collapse the contents of an name you use to create instances of the
object or behavior: object or to initially address the object in
Click on the Expand/Collapse arrow to scripting. For more information about
the left of the item’s name in the Object addressing objects in scripting, see
outline. “Object model overview” on page 214.
Shift + double-clicking on an object’s Giving every object in your project a
icon expands or collapses all children as unique name is recommended for two
well. reasons:
There is no way to distinguish between
items with the same name when
selecting a Target or Trigger object for
an action. See “Creating and deleting
actions” on page 120 for more infor-
mation.
Clicking on the Expand/Collapse arrow next
to an object (left) expands the list to display If there are two or more objects with
the contents of the object, including ani-
mated properties and child objects (right).
the same name attached to the same
object, then any reference to the object
To resize the Object outline: in a behavior script forces the scripting
Drag the bar between the Object outline engine to make an arbitrary decision as
and Time pane to the desired position. to which object to address. This means
To copy an object’s path to the clipboard: you may get different results each time
Right-click on the item in the Object you play a presentation.
outline and select Copy Object Path To rename items:
from the Context menu. This copies the 1. Do one of the following:
hierarchical path to the object (e.g.,
Scene.Layer.Cube3.Material13.rays). • Right-click on the name of the item
This is particularly useful for copying an in the Object outline and select
object’s complete path into a behavior Rename Item from the Context
script or an edit box in the Inspector of a menu.
custom behavior. For more information • Select the item in the Object outline
about the hierarchical path of objects, and then click on the text of the
see “Object model overview” on item’s name.
page 214. For more information about • Click on the name of the item in the
editing behavior scripts, see “Editing Object outline and press F2.
behaviors” on page 73.
2. Type a new name and press Enter.
Renaming objects
Note: Since objects whose names
Renaming instances of objects or behav- begin with a number cannot be
iors in the Object outline does not affect addressed by name in behavior
the name of the resource object in the scripts, you should avoid naming
Library, but it does change the item’s objects that way and rename any
name in the Inspector. objects that were previously named
If you want to create custom behaviors that way.
for a specific object, this will be the
User Reference 63
Anark_Studio_User_Guide.book Page 64 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
Deleting objects
outline and its timebar are grayed out. For information about deleting items
You cannot select it or change anything from the Library, see “Cleaning up the
about it until the Lock button is Library” on page 27.
disabled.
Locking or unlocking a parent object Controlling presentation
automatically locks or unlocks all of its playback
child objects. Materials do not have a A presentation can play, pause or
Lock button. reverse, either automatically or based on
user interaction. There are several ways
Deleting objects to control how a presentation will be
Objects can be deleted from either the played.
Object outline or the Project window. If The Initial Play State property of the
the object is a parent, all of its children Scene object can be set to either Play or
will be deleted with it. If the object is on Pause.
the Master slide, then all instances of the
object on all slides will be deleted when Play or Pause actions can be used to
any one of them is deleted. See “About play or pause the scene.
Master slides” on page 134 for more Go to Time actions can be used to
information.
pause or continue playing. Play or
To delete an item: Pause actions can then be used to start
1. Select an item in the Object outline playback again or to pause playback.
or in the Project window.
Reverse Play actions can be used to
2. Do one of the following: reverse playback from its current direc-
• Press the Delete key. tion (either forward or backwards).
• If you selected an object in the For information about the Initial Play
Object outline, right-click and select State property of the Scene, see “Setting
Delete Item from the Context menu. properties for the scene or slide” on
page 83. For information about setting
up actions, see “Creating and deleting
actions” on page 120.
User Reference 65
Anark_Studio_User_Guide.book Page 66 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
User Reference 67
Anark_Studio_User_Guide.book Page 68 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
User Reference 69
Anark_Studio_User_Guide.book Page 70 Monday, March 19, 2007 10:34 AM
Chapter 3
Creating a Project
71
Anark_Studio_User_Guide.book Page 72 Monday, March 19, 2007 10:34 AM
Chapter 4
Customizing and Extending Anark Studio
Editing behaviors
User Reference 73
Anark_Studio_User_Guide.book Page 74 Monday, March 19, 2007 10:34 AM
Chapter 4
Customizing and Extending Anark Studio
User Reference 75
Anark_Studio_User_Guide.book Page 76 Monday, March 19, 2007 10:34 AM
Chapter 4
Customizing and Extending Anark Studio
User Reference 77
Anark_Studio_User_Guide.book Page 78 Monday, March 19, 2007 10:34 AM
Chapter 4
Customizing and Extending Anark Studio
available in the Actions pull-down menu for 3. Set the desired event properties as
the behavior. explained below.
To delete a custom action: Name – Sets the name of the event as
Select the action and click on the Trash it will appear in the Event pull-
button ( ). down for the behavior. If this even
will be fired by script, this name
Working with custom events must be the same string that is set
You can expose a custom-written event for the AKEvent that fires it.
to the Anark Studio GUI so that it will Help String – Specifies a help string
appear in the Event pull-down menu on to display in Anark Studio for this
the Action tab for a behavior object. event. This string will appear as a
You must also write the event code that tool tip when the user mouses over
uses the AKEvent object and the the event. This field is optional.
fireEvent method of Behaviors, or use 4. Click OK to save your changes.
the Fire Event action to invoke the
event. See “Chapter 10: Using Scripting”
on page 203 for information about
writing behavior scripts.
To create or edit an event for a behavior:
1. Open the Custom Parameters dialog
using the instructions in “Creating
custom parameters for objects” on
page 75.
2. On the Events tab, click on the Add
Event ( ) button or select an exist-
ing event from the list. On the Actions tab, the custom events are
now available in the Event pull-down menu
for the behavior.
To delete a custom event:
Select the event and click on the Trash
button ( ).
User Reference 79
Anark_Studio_User_Guide.book Page 80 Monday, March 19, 2007 10:34 AM
Chapter 4
Customizing and Extending Anark Studio
81
Anark_Studio_User_Guide.book Page 82 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
Understanding different types that state for all selected objects until
of properties you change it again.
There are three different groups of prop-
erties displayed in the Inspector palette.
Basic Properties include commonly
and frequently used properties. In
addition, any custom properties
created for an object appear in the
Basic properties.
Advanced Properties include more
specialized and less frequently used
properties.
Shared Properties include properties
that are shared between Library
resources and all the instances of the
resource in the project. Images, video Click on the Expand/Collapse arrow to
and music have shared properties. access or close the Basic, Advanced or
Shared properties.
Changing a shared property on any
one instance automatically changes it In addition to these types of properties,
for all other instances and for the individual properties can be linked
Library resource. across instances and/or slides. See
To open or close a property group: “Linking and unlinking properties” on
Click on the Expand/Collapse toggle page 135 for more information.
next to the property group in the
Inspector. Anark Studio remembers About setting properties for
whether you have expanded or collapsed resources
the Advanced properties and maintains The settings of resources can only be
changed using the Inspector (i.e., they
can’t be edited in the Project window).
Built-in resource objects that have been
added to the Library (video, music and
behaviors) have a set of default proper-
ties that appear in the Inspector when
the resource is selected. The properties of
imported objects, such as externally
created behavior scripts, 3D models, 2D
graphics and sounds, are embedded with
the file data and become the default
settings for the resource.
Changes to a Basic or Advanced property
for a resource in the Library mean that
any new instance of the object will have
the new setting, while the parameter
About setting properties for Slides control how the Scene is played.
instances The Scene is the root object in the Anark
When a resource has been added to the Studio object hierarchy. It encompasses
project, it becomes an instance. An the overall 3D space in which a project
instance of an object has a set of default takes place.
properties that are constant throughout All layers are attached directly to the
its duration. To change a property over Scene. The only other objects that can be
time, you’ll need to set up animation attached to the Scene are behaviors,
keyframes for it. The value of the first sound and music.
animation keyframe set for an object
The Background Color property of the
property will override any default
Scene is shared across all slides.
settings. The object will begin its dura-
tion at the value of the first keyframe For more information about slides, see
and will end its duration at the value of “Understanding slides” on page 133.
the last keyframe.
User Reference 83
Anark_Studio_User_Guide.book Page 84 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
Width – Sets the scale of the layer along Layer Color – Sets the background color
the X axis. Specified as a percentage of for the layer. The background color will
the overall width of the scene, up to only be drawn if the Use Layer Color
400%. parameter has be turned on.
Height – Sets the scale of the layer along
Advanced Properties
the Y axis. Specified as a percentage of
the overall height of the scene, up to
400%.
Opacity – Adjusts the transparency of all
the objects attached to the layer. If the X Pivot – Sets the X position of the pivot
opacity is set to 0, the objects will be point of the layer. Specified as a
drawn in the scene, but will be invisible. percentage of the layer size.
This is different from Use Layer Color, Y Pivot – Sets the Y position of the pivot
which controls whether the “empty point of the layer. Specified as a
space” of the layer will be drawn. See percentage of the overall width of the
“Working with opacity” on page 111 for scene.
information about the effect of opacity
settings on how objects are rendered and Setting properties for text
the multiplicative relationship of the
Opacity properties of layers, groups, Text enables the creation of a variety of
models and materials. text objects, such as one-word labels,
headlines, captions and entire para-
Use Layer Color – Enables the Layer Color
graphs of scrollable text.
property. When Use Layer Color is on
(checked), this layer will completely All fonts that are used in a project can be
obscure any layers behind it (i.e., that embedded in the presentation file so
were drawn first). This is different from that they can be displayed on the
Opacity, which controls only the trans- viewer’s computer. See “Export Options”
parency of the objects that are attached on page 22 for more information.
to the layer. Defaults to off (unchecked). All languages supported by Microsoft
Windows can be used.
User Reference 85
Anark_Studio_User_Guide.book Page 86 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
sentation Size” on page 20 for more sions are limited to the width and
information. height of the layer. To create more
than one line of text, you can manu-
ally add returns.
Because the Text Box Width and
Height are automatically set to the
width and height of the text they can-
not be changed.
Paragraph – Paragraphs typically con-
tain more than one line of text and can
wrap automatically from line to line
using the Word Wrap property. The
text box for paragraphs is determined
based on the Text Box Width and
Height properties as a percentage of
the layer’s dimensions. Text that
extends beyond the boundaries of the
text box is clipped.
Render Style – Determines how the text
object is rendered.
Flat – Renders the text on a plane that
always faces the camera, always
remains at the specified font size and
can only be rotated around the Z axis.
Flat text is particularly useful for dis-
playing blocks of informational text.
larly useful for creating labels for parts Pivot – Adjusts the position of the text’s
or for diagrams. pivot point. The pivot point serves as the
center for the text’s rotation and
provides the coordinates for scaling.
User Reference 87
Anark_Studio_User_Guide.book Page 88 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
Horizontal Alignment – Determines how Text Box Height – Sets the height of the
paragraph text is positioned between the text box as a percentage of the current
left and right borders of the text box. layer’s dimensions. Text that extends
Left – Aligns the text along the left side beyond the boundaries of the text box is
of the text box. clipped. This property is only available
when the Text Type is set to Paragraph.
Centered – Centers the text within the
text box. Word Wrap – Enables word wrapping so
that text automatically wraps to the next
Right – Aligns the text along the right line when the text hits the horizontal
side of the text box. edge of the text box. This is only avail-
Vertical Alignment – Determines how able when the Text Type is set to Para-
paragraph text is positioned between the graph. This property is only available
top and bottom of the text box. when the Text Type is set to Paragraph.
Top – Aligns the text along the top of
Advanced Properties
the text box.
Middle – Centers the text within the
text box.
Bottom – Aligns the text along the bot-
tom of the text box.
Opacity – Adjusts the transparency of the Vertical Scroll – Moves the text down (by
text. If the opacity is set to 0, the text decrementing the value) or up (by incre-
will be drawn in the scene, but will be menting the value) in the text box.
invisible. See “Working with opacity” on Horizontal Scroll – Moves the text to the
page 111 for information about the right (by decrementing the value) or to
effect of opacity settings on how objects the left (by incrementing the value) in
are rendered. the text box.
Leading – Sets the spacing between lines Use Background Color – Enables the
of text. Background Color property. When Use
Tracking – Sets the spacing between all Background Color is on (checked), the
letters in a word, sentence and/or para- background of the text object will
graph. obscure the objects behind it. Defaults to
Text Box Width – Sets the width of the
off (unchecked).
text box as a percentage of the current
layer’s dimensions. Text that extends
beyond the boundaries of the text box is
clipped. This property is only available
when the Text Type is set to Paragraph. Background Color – Sets the background
color for the text object. The background
color will only be drawn if the Use Back-
ground Color parameter has been turned
on.
User Reference 89
Anark_Studio_User_Guide.book Page 90 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
Size” on page 20 for more that are not attached to it will appear to
information. be half as big.
Pivot – Adjusts the position of the
camera’s pivot point, which serves as the
center for its rotation.
Field of View – Controls the amount of
the scene visible and the amount of
perspective flare applied to the camera’s
view. It is measured in degrees of the
horizon. A very narrow field of view flat-
tens the perspective like a telephoto
lens, while a very wide field of view
exaggerates the perspective like a fish-
eye lens. If Orthographic is checked,
then the Field of View setting is inactive.
Range = 0 to 180 degrees. Default = 60
degrees.
Clipping Start – Sets a radial front clip
plane for the camera. Nothing in front
A normal camera view (top), and an of this plane will be rendered.
orthographic camera view of the same scene
Clipping End – Sets a radial rear clip
(bottom).
plane for the camera. Nothing behind
Position – Adjusts the position of the this plane will be rendered.
camera, relative to its parent.
Rotation – Adjusts the rotation of the Quick Definition
camera, relative to its parent. If a Target Clipping planes - A clipping plane is a
Lock has been set, then any Rotation plane that is vertical to the line of
setting will be ignored, because the sight, beyond which objects disappear.
camera will not “look away” from the The near clipping plane, which defines
Target. the point at which objects moving
Scale – Adjusts the scale of the camera towards camera will disappear, is set
and any child objects attached to it. with the Clipping Start property. The
Scaling the camera affects the objects in far clipping plane, which defines the
the scene that are not attached to it point at which objects moving away
inversely. If the camera is scaled to a from the camera will disappear is set
value of 2, then the objects in the scene with the Clipping End property.
User Reference 91
Anark_Studio_User_Guide.book Page 92 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
Working with fog can also add new lights to the layer.
Video cards can display two types of fog: There can be up to eight simultaneously
vertex and table. Vertex fog is drawn active lights for each layer.
based on the vertices of the objects in
the presentation and can sometimes be
blotchy, while table fog is always
smooth. Vertex fog is more commonly
supported than table fog. Because the
video card itself decides which type of
fog will be displayed, a presentation with
fog in it may appear differently on
different computers. There are a couple
of things to keep in mind when working
with fog:
Because vertex fog is blotchier on large
objects with fewer vertices (such as
cubes and rectangles) you may want to
use more complex (or “curvy”) objects
in the project. Light – Displays the current name of the
Light. For information about renaming
If possible, you should test your project objects, see “Renaming objects” on
on different computers with different page 63.
video cards to see what affect the
different types of fog will have on your Basic Properties
project. Light Type – Specifies whether the light
will be Point, Directional or Spot.
Setting properties for lights Directional – A Directional light casts
Lights are used to create natural lighting light in parallel rays, much like sun-
like sunlight, artificial lighting like light hitting the earth. The light is cast
indoor lighting, or more stylized lighting at the same angle on all the objects in
effects like theatrical productions the scene with equal brightness. The
might use. angle is determined by the Rotation
setting of the light. Because directional
When a new layer is created, it has a
lights don’t have a Brightness prop-
Light object already attached to it that
erty, you must change their Diffuse
provides lighting for the scene. You can
edit the properties of this light, and you
User Reference 93
Anark_Studio_User_Guide.book Page 94 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
A Directional light illuminates the group with A Spot light illuminates the group with a
flat, even lighting. cone of light.
Point – A Point light casts light in all Position – Adjusts the position of the
directions from a single point. Because light, relative to its parent. This property
it emits light equally in all directions, has no effect on Directional lights.
any Rotation setting is ignored for this Rotation – Adjusts the rotation of the
light type. light, relative to its parent. This property
has no effect on Point lights.
Scale – Adjusts the scale of any child
objects attached to the light.
Pivot – Adjusts the position of the light’s
pivot point. The pivot point for an
object serves as the center for its rotation
and provides the coordinates for scaling.
Light Color – Adjusts the color of the
light’s direct rays.
A Point light set inside a group illuminates
the objects from within.
User Reference 95
Anark_Studio_User_Guide.book Page 96 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
User Reference 97
Anark_Studio_User_Guide.book Page 98 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
Changing scale
• While holding down the Shift key, • Hold down the Shift key and use the
use the up and down arrow keys on up and down arrow keys to reach
your keyboard and move the group the desired scale.
or model to the desired position in • Right-click on the object and verti-
the Project window. cally drag it to the desired scale.
• Right-click on the group or model
Note: Only text objects with a Render
and move it to the desired position
in the Project window. Style set Full Perspective can be
scaled. See “Setting properties for
Note: Text objects with a Render text” on page 85 for more
Style set to Flat cannot be moved information.
along the Z axis. See “Setting proper-
User Reference 99
Anark_Studio_User_Guide.book Page 100 Monday, March 19, 2007 10:34 AM
Chapter 5
Setting Object Properties
Chapter 5
Setting Object Properties
Normal – Uses no special Blending the highlights and shadows of the base
Mode and makes only the material color.
color the result. Bleach – Takes the saturation of the
Screen – Additively blends the material material color and adds it to the base
color with the base color by multiply- color. The effect is similar to bleaching
ing the inverse of the color values to (lightening) with specific colors.
create the result. Screen always creates Ghost – Multiplies the material color’s
a lighter final color. The Opacity prop- opacity value (i.e., its alpha channel
erty does not affect this mode. data) by its luminosity value and mul-
Multiply – Additively blends the mate- tiplies the result with the inverse of the
rial color with the base color by multi- base color to create the final result. The
plying the color values to create the Opacity property does not affect this
result. Multiply always creates a darker mode.
final color. Saturate – Doubles the material color’s
Overlay – Overlays the material color values and blends them with the base
onto the base color while preserving color. The Opacity property does not
affect this mode.
Opacity – Adjusts the transparency of the must be checked in order for this setting
material. If the opacity is set to 0, the to appear.
object will be drawn in the scene, but Double Sided – Specifies the type of
will be invisible. See “Working with culling to perform on this object. This
opacity” on page 111 for information can be used as an optimization tool to
about the effect of opacity settings on reduce the number of polygons that
how objects are rendered and the multi- must be rendered to accurately display
plicative relationship of the Opacity this material on an object.
properties of layers, groups, models and
materials. 2 Sided – Specifies that no culling will
be performed.
Advanced Properties 1 Sided:Clockwise – Specifies clockwise
culling on the object, so that the inte-
rior of the model is displayed rather
than the exterior.
1 Sided:Counterclockwise – Specifies
counterclockwise culling on the object,
so that only the exterior of the model
is displayed.
Render Mode – Specifies whether the
object is displayed as a wireframe, a
Note: If the material is too dark when
point cloud, or a solid. Defaults to Solid.
1 Sided is set, increase the Emissive
Ambient Color – Adjusts the color of the Power.
material as viewed in indirect light.
Quick Definition
Enable Specularity – Specifies whether Culling - Culling is the process of elimi-
the material will display specular nating the polygons that face away
highlights (i.e., glossiness) and enables from the viewer and therefore can’t be
the Specular Color and Specular Power seen. Culling speeds up the rendering
properties. of the scene, since all those unseen
polygons use up valuable processing
power.
Chapter 5
Setting Object Properties
Setting properties for images Note: Most video cards can’t support
Images in Anark Studio are the equiva- more than four images per model or
lent of image or material maps in 3D material, and some can only support
modeling programs. Any 2D graphic two images, so it’s a good idea to use
image can be an image map. It may as few images per material as
contain a black and white or color possible. Be aware of the limitations
graphic or photograph. Any image map and capabilities of your video card.
information that has been applied to a
model is included with the material
information when the model is
imported into Anark Studio. When an
instance of the object is added to the
project, the material and image informa-
tion are added as instances, too. Images
that are imported along with a 3D model
can also be attached to the materials of
other objects.
For some tips on optimizing the file size
and getting the best results from image
Image Name – Displays the current name
maps, see “Preparing video clips and
of the image for the image. For informa-
graphics as image maps” on page 41.
tion about renaming objects, see
Images can only be attached to layers, “Renaming objects” on page 63.
groups or materials. When an image is
For specific information on the different
attached to a layer or a group, it is auto-
types of image properties, and how to
matically mapped to a newly created
use them, see the following sections:
model (a rectangle primitive) in both the
Object outline and the Library, and the “Basic properties (for images)” on
original image is turned into a child page 105
object of the new model’s material.
“Advanced properties (for images)” on
Double-clicking on an image in the page 107
Object outline will open it in your
default image viewing application. “Shared properties (for images)” on
page 108
For a complete list of supported image
formats, see “Supported Media Formats” “Mipmapping” on page 109
on page 305.
Basic properties (for images) object, which the object then reflects.
Texture Mapping – Controls the way the This is often used to create the look of
image is wrapped around or projected glass or metal, which reflect what’s
onto the object. around them.
Texture Type – Specifies how the image
will affect the appearance of the
material.
Chapter 5
Setting Object Properties
Light Map – Applies the image to the Negative Map – Applies the image to
material as a light map. Light maps are the material in the inverse, resulting in
used to simulate real-world lights on a negative of the image.
materials. This map type is less dra- U Tiling – Specifies the type of tiling (or
matic than the Specular Map and will repetition) to apply horizontally to the
slightly brighten the material without image. Tiling is typically used to create
over-brightening. For more informa- wallpaper-like patterns with a simple
tion about creating light maps, see image. Tiling works best when the orig-
“Creating a Light Map” on page 111. inal image size is a power of 2 (8 x 8
Emissive Map – Quadruples the color pixels, 64 x 64 pixels, etc.).
saturation and luminosity (or bright- Tiled – Repeats the image over and
ness) of the material based on the color over.
information of this image.
Mirrored – Flips the image repeatedly.
SuperCharge Map – Doubles the color
saturation and luminosity of the mate- No Tiling – Does not repeat the image.
rial based on the color information of
this image.
Chapter 5
Setting Object Properties
V Pivot – Sets the vertical location of the No Transparency – Prevents the ren-
pivot point of the image on the object. derer from using the image’s alpha
Because the pivot point is calculated in channel data.
global space, a Position V offset must For more information on how opacity
also be set in order to see a difference in settings are handled in Anark Studio, see
the pivot point in the local space of the “Working with opacity” on page 111.
image. If the U Pivot and V Pivot are set
to 0, then the pivot point is located in Shared properties (for images)
the bottom left hand corner of the The contents of this area of the Inspector
model. Specified in values between 0 pane vary considerably. For example,
and 1.0. you will see different choices if the
image is associated with an object as a
material. In this case, see “Mipmapping”
on page 109 for information about the
available choices
Mipmapping
image, although it can make the image images” on page 169 for more
appear grainier when close up. information.
Compression Type – Specifies the type of Connect to Source – Allows you to view a
compression algorithm to be applied to remote image while working in Anark
the image. There is a trade-off between Studio. The Remote Source must also be
image quality and finished file size. In specified. When Connect to Source is
general, you should compress images as checked, you cannot edit the Remote
much as possible while maintaining the Source property.
level of quality you need.
Lossless – Slightly compresses the file
Mipmapping
size without any loss of image quality. Mipmaps help improve the visual
quality of rendered images. Mipmapping
JPEG – Compresses continuous tone works by creating lower resolution,
images such as photographs while prefiltered versions of an image that you
maintaining optimal image quality intend to use as a texture map. When
and enables the Compression Quality rendering the image, the appropriate
slider. resolution mipmap is chosen and
Compression Quality – Controls the size thereby the texture pixels (texels) are
of the color palette for the image. If an already down-sampled and filtered when
image uses 256 colors and Compression they arrive on the screen.
Quality is set to 50, then only 128 colors
will be available in the palette. This
property is only available when JPEG has
been selected as the Compression Type.
Defaults to 75.
Remote Source – Specifies either the URL
of a JPEG or PNG image file, or the fully
qualified absolute or relative path to it.
The relative path must be preceded by ./
to indicate the current directory (or ../ to
go up one directory level, etc.). If no
Remote Source is specified, then the The downsampled images of the brick wall
are shown to the right. Each new image is
embedded image (i.e., the image exactly half the size—in each direction—of
resource in the Library) will be the previous image on which it is based.
displayed. If Connect to Source is
The computations for the mipmapping
checked, you cannot edit the Remote
are handled on the video card, so it can
Source property. This property can be
be rendered quickly.
used to load a sequence of images if used
in conjunction with a properly written The three mipmapping algorithms you
behavior. Because it may take a moment can choose from are:
or two to load a remote image, you can • Bi-linear
use the PreBufferAsset behavior to begin
• Tri-linear
loading the image asset before the image
is displayed. See “Setting up dynamic • Tri-linear anisotropic
Chapter 5
Setting Object Properties
The options for bi-linear and tri-linear that are far away and steeply angled
are the same; with tri-linear anisotropic, with respect to the camera.
you are presented with another option,
Quick Definition
anisotropy degree.
Anisotropy (the opposite of isotropy)
Bi-linear – Bi-linear filtering uses points is the property of being directionally
from the mipmap to perform bilinear dependent. Something that is
interpolation between the four texels anisotropic may appear different,
nearest to the point that the pixel or have different characteristics in
represents. different directions.
Chapter 5
Setting Object Properties
3. Click on the imported Light Map 2. Import the image to be used as the
resource in the Library. Opacity Map.
4. Set the Texture Mapping to Object 3. Set the Texture Type to Opacity Map.
Projection. 4. Expand out the material of the model
5. Set the Texture Type to Light Map. you want to apply the Opacity Map
6. Expand out the material of the model to by clicking on the Expand/Col-
you want to apply the Light Map to lapse arrow next to it in the Object
by clicking on the Expand/Collapse outline.
arrow next to it in the Object outline. 5. Drag the Opacity Map image from
7. Drag the Light Map image from the the Library onto the model's
Library onto the model's material. material.
From left to right: a 3D model, a grayscale From left to right: a 3D model, a grayscale
image, and the image applied to the model image, and the image applied to the model
as a Light Map. as an Opacity Map.
Creating an Opacity Map If for some reason you only have a 24-bit
Opacity Maps allow you to create trans- image to work with, Anark Studio
parent holes in an object. In order to do provides a way to create an alpha
this, Anark Studio needs alpha channel channel for it so that it can be used as an
data for the image. The alpha channel Opacity Map.
specifies the transparency of each pixel
in the image, just as the red, green and Important: The Make Opacity Image
blue channels together specify the color operation that creates the alpha
of each pixel. Some popular image types, channel for the image turns the
such as .jpg, do not have any alpha image into a grayscale and changes
channel data. They are 24-bit images as the color data. Once it has been exe-
opposed to 32-bit images (such as .png cuted, it cannot be undone inside
and .tga), which include 8 bits of alpha Anark Studio. You should only use it
channel data. on 24-bit images that you want to
use as Opacity Maps. If you run the
In general, if you want to create an
operation and decide you want to
Opacity Map, you should use a 32-bit
undo it, you will have to delete the
image.
Library resource and reimport the
To create an Opacity Map using a 32-bit original image.
image:
1. Import a 3D model into Anark Studio To create an Opacity Map using a 24-bit
and drag an instance of it onto the image:
Project window or the Object outline 1. Import a 3D model into Anark Studio
and drag an instance of it onto the
Chapter 5
Setting Object Properties
Auto Start – Sets whether the video will specified. If no Remote Source is given or
automatically start playing when it first if Connect to Source is not turned on
appears in the Timeline. If Auto Start is (checked) then the model may be
off (unchecked) you can set the video to displayed with a rainbow pattern on it
play based on a scripted behavior. instead of the video. If Connect to
Defaults to on (checked). Source is checked but the connection
fails for some reason, then a transparent
Advanced Properties image is used that makes the object
transparent.
Chapter 5
Setting Object Properties
Inspector palette to edit those properties Lua – Lua is a free, light-weight pro-
just as you would for an object. gramming language designed for
extending applications.
Other – Allows you to specify the
scripting language of your choice.
Shared Properties
Chapter 5
Setting Object Properties
When any of these properties are as fast as normal, etc. A negative value
animated, the keyframes are evaluated in (e.g., -.3, -2, etc.) makes the component’s
the parent Timeline, which would be Timeline run backwards. This setting
either the Scene’s Timeline or, if it’s a does not affect the frame rate of the
nested component, the parent compo- presentation or how often the scene is
nent’s Timeline. updated.
The special component properties Play Initial Play State – Controls whether the
Mode, Playback Speed and Initial Play component will initially play or be
State appear in the Inspector palette only paused. Defaults to Play.
when you’re inside the component. Play Mode – Controls how the compo-
nent’s Timeline will be played back
during this slide.
Stop at end – Sets the component’s
Timeline to play through from begin-
ning to end once.
Loop – Sets the component’s Timeline
to play through from beginning to end
continuously for the duration of the
Slide – Displays the name of the current
component.
Slide. For information about renaming
objects, see “Renaming objects” on Ping Pong – Sets the component’s
page 63. Timeline to continuously play forward
and then in reverse for the duration of
Playback Speed – Controls the speed at
the component.
which the component’s Timeline is
executed. This affects the speed of the Ping – Sets the component’s Timeline
animation for all the objects inside the to play forward and back only once.
component, including any animation Play Through – Sets the component to
created by a behavior that uses the play from beginning to end once and
contextTime property. A setting of 2 then continue onto the next slide.
means animated objects will appear to
move twice as fast as normal; a setting of
.5 means they will appear to move half
119
Anark_Studio_User_Guide.book Page 120 Monday, March 19, 2007 10:34 AM
Chapter 6
Working with Actions, Slides and Components
Chapter 6
Working with Actions, Slides and Components
Selecting an event
An event is a pre-defined occurrence that
happens during playback. Events are
used to trigger actions in a presentation.
For example, you can use a mouse event
to begin an animation sequence, or you
can use a key event to pause the
presentation.
There are several different types of built-
The object selection box lets you use either a in events. In addition, Time Labels
relative or absolute reference to the object. applied to points in the Timeline can be
An Absolute Reference locates the object used as events. For more information
using a direct reference to it. If the object about Time Labels, see .
is moved around in the scene, the Abso- The list of available events is determined
lute Reference will be updated to object’s by the type of object selected as the
new location. Use the absolute path Trigger Object.
when you may be rearranging items or
actions in your scene, and want the
action to always point to the original
object, no matter where it ends up in the
scene.
A Path Reference locates the object using
a hierarchical (DOM-based) path. By
default, the displayed Path property will
be the relative path specified by walking
up the levels of the hierarchy using the
parent property of objects. You can also
specify a root-level path. Use the Path
reference when you want to reuse an The event selection box lets you choose from
object like a component with another a list of events that are available for the
Trigger object for an action.
object, or wish to move the action to
another object and have the object that For information about setting up an
the action refers to automatically action, see “Creating and deleting
change. actions” on page 120.
Selecting an event
In addition to the following list of avail- onKeyUp – This event is fired when any
able events, you can write custom events key is released.
for a behavior and expose it to the Anark
Studio interface using the instructions in Loading events
“Working with custom events” on onLoadProgress – This event is fired
page 79. continuously as a Playback Module is
loading. For more information about
Attach events loading Playback Modules, see “Loading
onAttach – This event is fired when the components dynamically” on page 132.
Trigger object is attached to the scene. onLoadError – This event is triggered
Attachment corresponds to the moment when a Playback Module cannot prop-
when the object’s timebar starts. erly load. For more information about
onDetach – This event is fired when loading a Playback Module, see “Loading
when the Trigger object is detached from components dynamically” on page 132.
the scene. Detachment corresponds to onLoadComplete – This event is triggered
the moment when the object’s timebar when a Playback Module has finished
ends. loading. For more information about
loading a Playback Module, see “Loading
Key events
components dynamically” on page 132.
onKeyDown – This event is fired when
any key is pressed.
Chapter 6
Working with Actions, Slides and Components
Selecting an action
Chapter 6
Working with Actions, Slides and Components
Selecting an action
Chapter 6
Working with Actions, Slides and Components
Selecting an action
Chapter 6
Working with Actions, Slides and Components
Making actions active and are listed in, you can use copy/paste to
inactive reorder them when needed. Pasted
actions are added to the end of the
The Active toggle ( ) next to each
Actions list.
action allows you to make the action
inactive or to reactivate it. This is partic- While any action can be pasted onto any
ularly useful for controlling whether or object, the action will only be valid
not an action will be active for all under the following circumstances:
instances of an object on the Master The Trigger and Target objects must be
slide. See “About Master slides” on active at the same time as the object
page 134 for more information. that now has the action.
Copying and pasting actions The path to the Trigger and Target
Actions can be copied or cut from one objects from the current object must
object and then pasted onto another still be valid. See “Specifying paths for
object, or even the same object. Because Trigger and Target objects” on
actions are executed in the order they page 122 for more information.
To copy or cut and paste an action: Target object, you can match it to any
1. Select an action in the Actions pal- other vector property (Scale, Position,
ette. Pivot, etc.). Similarly, if you want to set
2. Do one of the following: the Brightness property of a light, you
can match it to any other floating-point
• Copy the action by selecting Edit > property, including Emissive Power or
Copy Action or pressing Ctrl + C. Opacity.
• Cut the action by selecting Edit >
Cut Action or pressing Ctrl + X. Working with time labels
3. Select the object to paste the action A Time Label is a marker for a particular
on. point in time in the presentation. They
4. Do one of the following: can be applied to either the Scene or to a
component object, although they
• Select Edit > Paste Action or press
cannot be added to the Master slide.
Ctrl + V.
Time Labels can be used in actions in
• Right-click in the Actions palette for two ways.
the item in the Object outline and
select Paste Object from the Context They can be used as a time marker in a
menu. Go to Label action. During playback,
the specified event will cause the
The pasted action is added to the end of
presentation to jump to the Time
the list of actions for the object.
Label.
Dynamically matching a They can be used as an event that
property value using an action executes some other kind of action.
When you create a Set Property action,
you have the option of selecting a Value
Type. The default is to set a specific
To insert a new Time Label:
value, which is appropriate for most situ-
1. Select the Scene or a component in
ations. Under certain circumstances,
however, you may want to use the From the Object outline. To insert a Time
Another Property option. The From Label on a component, you must be
Another Property value allows you to inside the component’s Timeline. For
match the property of the Target object more information, see “How the
to the current value of a different Scene and component Timelines
object’s property. work” on page 138.
2. Move the Playhead to the location
Among other things, this can be used to
dynamically draw values from the on the Timeline where you want to
custom properties of a behavior, to place the Time Label.
synchronize the movement of objects, or 3. In the Time Pane, right-click on the
to quickly align one or more objects Timeline bar for the Scene or compo-
based on user interaction. nent and select Insert Time Label
Only similar property types can be from the Context menu.
selected. For example, if you want to set The Time Label will be added at the
a vector property such as Position for the current location of the Playhead.
Chapter 6
Working with Actions, Slides and Components
Understanding slides
Chapter 6
Working with Actions, Slides and Components
any other slide and the changes are To exit the Master slide:
made to all instances on all other slides.
Click on the Edit Master button on the The length of an object’s timebar.
Slide tab. Only the contents of the The state of its Active toggle.
Master slide will appear in the Timeline
and Project window. The Playback Speed, Initial Play State
and Play Mode properties of the Scene
and components.
When an object property is linked to the
Master slide, it appears in blue.
Chapter 6
Working with Actions, Slides and Components
For more information about working and actions are copied to the slide as
with objects and properties on the well. There is one exception to this rule,
Master Slide, see “Understanding slides” however. If an object that is on the
on page 133. Master slide contains objects that are not
on the Master slide, and the object is
copied or duplicated on the Master, then
only the master object is copied.
Using components
menu systems, and make them easy to The Butterfly component contains the wings
reuse and share. and body. The flapping of the wings has
been animated in the component’s local
Components provide a group of one or time and can be looped continuously.
more objects with an independent clock
An example of using a component to
(or multiple clocks if new slides are
easily create repetitive animation is a
added), allowing them to operate in
butterfly fluttering around on the
more than one Timeline at the same
screen. You could create a group that
time. When an object is made into a
contained a model of a butterfly and set
component, the Component object still
a couple of keyframes for the wings to
has a timebar in the current Timeline.
animate them flapping. If you then
The objects that belong to the compo-
make the butterfly group into a compo-
nent have their own timebars that exist
nent and set the component’s Play Mode
in the component’s independent Time-
to Loop, the wings will continuously
line, which can be accessed by going
flap. In the Scene’s Timeline, you could
inside the component.
then animate the component group
Components can be nested inside other moving around in the scene. When the
components. Because components func- presentation is previewed, the butterfly
tion just like miniature scenes, they have will flap its wings as it flutters around
one or more associated slides. the screen.
For more information about Timelines,
see “How the Scene and component
Timelines work” on page 138. For more
information about slides, see “Under-
standing slides” on page 133.
Chapter 6
Working with Actions, Slides and Components
The object and any attached children are The Scene’s Timeline displays all the
now encapsulated within the compo- objects that are attached to the scene
nent group and are automatically placed and its children. While it shows the
on the Master slide inside the Compo- timebars of components, it does not
nent’s Timeline. display the timebars of the objects that
are inside a component. Each Compo-
Note: Only music and sound objects nent object’s Timeline displays the time-
that are not attached directly to the bars of the objects inside that
Scene object can be turned into component.
Components. The currently active Timeline deter-
To edit a component, do one of the mines what objects are visible, what new
following: objects will be added or attached to,
Double-click on the component in the what can be selected and what anima-
Object outline. tion will be viewable in the Project
window.
Right-click on the component in the
Object outline and select Edit Compo- Only the objects belonging to the
nent from the Context menu. active Timeline can be selected, even
though other objects in other Time-
To exit a component:
lines may be visible in the Project
Click on the icon of the Scene or desired
window.
Component or Scene in the Bread-
crumbs bar. In the Scene or parent Timeline, a
component object as a whole can be
selected, but not the individual objects
within it.
When you go into a different Timeline, includes its duration, its property
the current location of the Playhead settings, and any associated actions and
determines what objects in other Time- animation. The butterfly component
lines will be visible in the Project might contain two slides: flapping and
window. For example, if the Playhead resting.
is currently at 4 seconds, but several Components can be nested inside other
objects in the Scene Timeline don’t components, making Timelines hierar-
begin their duration until 5 seconds, chical. In addition, multiple slides mean
those objects will not be visible in the that Timelines can also operate in
Project window when you go into the parallel, making them branched. As you
Component Timeline. create components and slides in Anark
Studio, the Breadcrumbs bar indicates
Playback in different Timelines your current location among the
When you play a project using the Play different Timelines and helps you navi-
button ( ), the animation from the gate through them. The current slide is
active slide will be executed, but not shown in parentheses.
the animation in any components.
When you drag the Playhead along the
time measure (called scrubbing), only
the animation for the currently active
Timeline is executed.
The Breadcrumbs bar lets you navigate out
When you preview using the F12 key, of components. The Table of Contents com-
all the animation from the active slide ponent contains two slides, Active and Inac-
will be executed, including any tive, and the Open-Close Button component
components. contains two slides, Over and Idle.
Chapter 6
Working with Actions, Slides and Components
Specifically, the component begins at 0 them so that they are inside the compo-
seconds and lasts until the end of the nent. This means that you cannot move
timebar at the latest point on the time an object that is already in the Object
measure. outline into the component. Likewise,
when working in the component’s Time-
line, you can only add objects to the
component. You can’t access anything
that uses the parent Timeline.
To add an object to the component:
1. Make sure you are in the compo-
nent’s Timeline.
The Butterfly component is active in the 2. Select an item in the Library or Stor-
scene for 4 seconds (top) while the content age palette or in a Windows Explorer
of the component lasts for one second (bot- window.
tom).
3. Do one of the following:
This seems fairly simple until you
consider that components are often used • Drag it onto the bar of the Compo-
to create interactive elements like menu nent or an object inside the Compo-
systems and could conceivably have a nent.
longer duration than the presentation • Drag it onto the Project window. It
itself. A component that is longer than will be attached to the Component
the main presentation’s duration will be object.
cut off at the end of the main presenta-
tion, unless the Scene’s Timeline has Copying objects in components
been paused or it has been looped. Copying objects inside a component
works much like copying other objects
Adding and attaching objects to in the project. You can duplicate them
components using key commands and menu options,
There is a difference between attaching and by holding down the Ctrl or
an object to a component and adding an Command key and dragging them, as
object so that it will share the compo- explained in “Copying and duplicating
nent’s unique Timeline. The Timeline objects in the project” on page 58.
you are currently in controls which of Objects can also be copied from the
these operations is done. Scene’s Timeline or the parent Timeline
into a component and vice versa.
When working in the Scene’s Timeline,
you can only attach objects to the
component object; you cannot add
Chapter 6
Working with Actions, Slides and Components
Chapter 6
Working with Actions, Slides and Components
145
Anark_Studio_User_Guide.book Page 146 Monday, March 19, 2007 10:34 AM
Chapter 7
Animating Objects
Animation is created by setting different tion of the Playhead and the property is
values for a property at different points added to the Object outline.
in time. In Anark Studio, the values are
set in the Inspector palette or items are
dragged in the Project window to change
the values. The Timeline tab is used to
access those points in time of the presen-
tation.
The points in time where the values are
set are called keyframes. At least two
keyframes are needed for a property to
be animated. Anark Studio interpolates
the change in the values between
keyframes and generates the additional
frames needed to create smooth anima- Turning on the Animation toggle for a prop-
tion effects. erty adds the property to the Object outline
and sets a keyframe.
Note: Behavior scripts that operate You can turn on the toggle for a single
on a property that has been ani- property at a time or for all of an object’s
mated using keyframes may override properties at once by turning on the
those animation settings. See “How Master Animation toggle.
behaviors affect animation” on
page 237 for more information.
changes made to its value affect only the the amount of the Time measure visible
default (i.e., static) settings of the object. in the palette.
Because you can change the scale of the
Tip: The Master Animation toggle for Timeline to display just a short section
an object can be used together with of a presentation, the entire presenta-
the autokeyframing features to tion, or anything in between, the tick
quickly enable animation and then marks on the Time measure can repre-
set keyframes for all of an object’s sent less than a hundredth of a second
properties as you make changes. For up to a whole minute or more.
information about autokeyframing,
To expand or contract the Time measure:
see “Autokeyframing” on page 154.
Do one of the following:
Overview of the Time pane Click and drag the start or end handle
of the scroll bar until the desired
section of the Time measure is in view.
Press the plus (+) or minus (-) key. Plus
zooms in; minus zooms out.
Hold down the Ctrl key and roll the
mouse wheel up or down.
Chapter 7
Animating Objects
Timebars with start and end handles dis- With the exception of layers, sounds
played (top) and hidden (bottom). and music, when an item is added to
the project, its timebar is set to the
same times as its parent’s timebar
(holding down the Ctrl key overrides
this, as described in “How the Ctrl key
affects adding objects” on page 54). For
details about how layers, sounds and
music are handled, see “The duration
Resizing timebars
Chapter 7
Animating Objects
To resize a timebar using the keyboard: Working with cameras and the
Press [ to move the start of a selected timebar
object’s timebar to the current location Only one camera can be active for a
of the Playhead. All of the object’s chil- layer at a given time. This means that if
dren will move along with it, with two there is more than one camera for a
exceptions: layer, their timebars should not overlap.
The timebars of locked objects are not If there is some overlap between time-
moved. bars, Anark Studio arbitrarily decides
which one is active.
The timebars of objects inside compo-
nents are not moved.
Pressing Ctrl + [ will move the timebar of
the selected object without affecting its Only one camera can be active for a layer at
children. a given time, so the timebars for cameras
should not overlap.
Press ] to move the end of a selected
object’s timebar (and all of its children’s) In this example, the order for the active
to the current location of the Playhead. cameras is:
The same two exceptions noted above
1. Zoom
still apply.
2. Fog
Pressing Ctrl + ] will move the end of the
selected object’s timebar alone., 3. Normal
Chapter 7
Animating Objects
Setting keyframes
Chapter 7
Animating Objects
Selecting keyframes
Chapter 7
Animating Objects
4. Select the desired object. The copy different keyframes for a property, and
operation will be successful only if you can even mix linear interpolation
the object has a corresponding with smooth interpolation on a single
property. keyframe.
5. Do one of the following: Each time a keyframe is added, Anark
• Choose Edit > Paste. Studio creates it with a default interpola-
tion of either linear or smooth. You can
• Press Ctrl + V. then adjust the Ease In and Ease Out
• Right-click and select Paste values for individual keyframes if you
Keyframe(s) from the Context need to.
menu.
The keyframe or keyframes will be
pasted into the appropriate properties
for the object. The leftmost pasted
keyframe will be placed at the current
location of the Playhead. All other
keyframes are offset accordingly.
Controlling keyframe
interpolation
There are two types of interpolation that
keyframes can perform in Anark Studio:
linear and smooth. Linear interpolation
is the simplest to understand. It goes
from the starting value of one keyframe
to the starting value of the next
keyframe in a straight line. There is a
uniform rate of change between the
keyframes. For spatial properties, this
can give a “mechanical” look to
animations, which may be undesirable.
Smooth interpolation is more complex Animation using Smooth interpolation (top)
eases into and out of the keyframes, while
because it uses two additional control animation using Linear interpolation (bot-
values (Ease In and Ease Out) to create a tom) changes uniformly between keyframes.
nonlinear curve that produces a nonuni-
To specify whether the default setting for
form rate of change between the keyframes will be linear or smooth:
keyframes. This can be used to create 1. Choose Edit > Application Prefer-
smoother animation effects for spatial ences (Ctrl + P).The Preferences dia-
properties, and gradual starts and stops log will open.
for any property.
2. Set the desired Default Interpolation
You can mix linear interpolation with value and click OK.
smooth interpolation among the
Chapter 7
Animating Objects
The interpolation of any existing Ease In – Controls how slowly the object
keyframes will not be changed; however, decelerates from the value of the
the interpolation of any new keyframes previous keyframe toward the value of
will be set to this value. this keyframe. If Ease In is set to a high
To set the interpolation for a keyframe value, the change will be more gradual
(or multiple keyframes): (hence the term “Ease In”). If Ease In is
1. Select the keyframe(s). set to a low value, the change will be
fairly rapid. A value of 0 makes this
2. Do one of the following:
portion of the keyframe linear, meaning
• Right-click on a selected keyframe there will be a completely uniform rate
and select Set Interpolation from the of change.
Context menu.
Any Ease In setting for the first keyframe
• Select Timeline > Set Interpolation. for a property is ignored because there is
The Keyframe Interpolator dialog no previous keyframe value to work
box will open. with. The value of the first keyframe will
override any static values that have been
set; this means that the object will begin
its duration at the value of the first
keyframe. For information about setting
static values for objects, see “Chapter 5:
Setting Object Properties” on page 81.
Ease Out – Controls how quickly the
object accelerates from the starting value
of the keyframe toward the value of the
next keyframe. As with Ease In, if Ease
3. Set the desired values and click OK.
Out is set to a high value, the change
Properly controlling keyframe interpola- will be more gradual. If Ease Out is set to
tion requires an understanding of how a low value, the change will be fairly
the different values affect the “change rapid. A value of 0 makes this portion of
curve.” the keyframe linear, meaning there will
be a completely uniform rate of change.
Tip: One of the best ways to gain an Any Ease Out setting for the final
understanding of the range of inter- keyframe for a property is ignored, since
polation settings is to try different the value of the next keyframe must be
combinations of them for both a known in order to create the change. An
spatial property (such as position) object property remains at the value of
and a nonspatial property (such as the final keyframe for the rest of the
opacity) on an object in Anark Stu- duration of the object.
dio.
Chapter 7
Animating Objects
Chapter 7
Animating Objects
Chapter 7
Animating Objects
165
Anark_Studio_User_Guide.book Page 166 Monday, March 19, 2007 10:34 AM
Chapter 8
Working with Streaming Media and Dynamic Images
If the file will be streamed or loaded in high and low compression versions,
a Web-based application and the you should set this to the low
streaming media or image file is compression version while you are
located on a different server than the working on the project and the
.am file, use the URL. higher compression version when
you are ready to publish it.
If the file will be streamed or loaded in
2. Attach the video to either a material
a non-Web-based application and the
on a model or to a layer or group by
streaming media or image file is
dragging it onto one of these items in
located on a different server than the
the Object outline. If the video is
Anark Media, projector or screen saver
attached to a layer or a group, a
file, use the absolute path, which
model (a rectangle primitive) will
describes the full navigation path to a
automatically be created for it both
file.
in the Object outline and in the
Library. Attach the music object to
Note: Universal Naming Convention
the Scene. If you are going to stream
(UNC) paths, which are often used
the media over the Web, you should
to navigate to files on a network,
make sure the start time of the music
cannot be used as the Remote
or video object begins at least a few
Source.
seconds into the presentation.
Adding streaming media files
Setting up streaming files
to a project
If you imported the video or music,
To add video or music to a project: Anark Studio used the absolute path to
1. Do one of the following: its current location as the Remote Source
• Import the video or music file as a property. When you’re ready to publish
resource in the Library using the the presentation, you need to make sure
instructions in “Importing objects” the Remote Source property is set to the
on page 51. If you are working with media file’s final location. In most cases,
a proxy video file (i.e., one that can this will be the relative path. However,
be scrubbed with the Playhead), you if the media file will be located on a
will need to import the low different server than the .am file, you
compression version while you are must specify the absolute path or the
working on the project, and later URL. Even if you are streaming the file in
reference the higher compression a non-Web-based application, latency
version when you are ready to issues may arise if the media file and the
publish it. .am file are not on the same server or
• Create a video or music resource by computer. If that’s the case, you may
need to use the instructions for
dragging on the Video ( ) or
streaming in a Web-based application.
Music ( ) button on the Basic Lastly, it’s always a good idea to clean
Objects tab. You can drag it onto the out the Library before you publish a
Object outline or onto the Project presentation.
window. Set the Remote Source for
the music or video. If you have both
Chapter 8
Working with Streaming Media and Dynamic Images
While Anark Studio allows you to stream project so it can begin prebuffering
up to five media files in a project, keep immediately.
in mind the bandwidth constraints of
your audience and use the minimum
number that will be effective.
To stream video or music in a non-Web-
based application:
1. Select the video or music resource in
the Library.
2. On the Inspector palette, set the
Remote Source property to the fully
qualified relative or absolute path to
the video or music file.
3. Right-click in the Library and select
“Delete Unused Resources” from the
Context menu.
To stream video or music in a Web-based PreBufferAsset behavior
application:
5. In order to avoid a noticeable pause
1. Select the video or music resource in
during playback, a section of the pre-
the Library.
sentation would need to be looped
2. On the Inspector palette, set the while the system is prebuffering the
Remote Source property to the media streaming file(s). If you don’t mind
file’s final file location. This should the pause, you can skip ahead to step
be the relative path unless the media 6. Otherwise, you can use the follow-
file and the .am file are not on the ing optional steps to loop a section of
same server, in which case this the animation while the media is
should be the URL. You must do this being buffered.
for each file that will be streamed. If
a. Turn on Use Buffer Loop? by
HTTPS is used, port 443 is used by
checking it.
default. To specify a different port,
the URL must be followed by a colon b. Set Buffer Loop Beg. and Buffer
and a port number (e.g., https:// Loop End to any period of time in
www.anark.com:444). the presentation that doesn’t
intersect the timebar for any
3. On the Storage palette, select the
media file to be streamed. This
PreBufferAsset behavior from the
would typically be a small section
Miscellaneous folder on the Behavior
of animation at either the very
Library tab and drag it onto the
beginning or very end of the scene
Library palette.
that could function as a “loading”
4. Attach the PreBufferAsset behavior to screen.
either the scene or the layer that con- c. If the looping animation is at the
tains the video or music object. It’s a beginning of the scene, then when
good idea to place the start handle of the streaming media is ready to
the behavior at the beginning of the begin playing, the system will
Chapter 8
Working with Streaming Media and Dynamic Images
PreBuffer Asset behavior. The assets can 6. Set Buffer Loop Beg. and Buffer Loop
include any combination of video, End to any period of time in the pre-
music and images. sentation that doesn’t intersect the
To prebuffer images: timebar for any object you want to
1. Select the image resource in the prebuffer. This would typically be a
Library. small section of animation at either
the very beginning or very end of the
2. On the Inspector palette, set the
scene that could function as a “load-
Remote Source property to the ing” screen.
image’s final location. This should be
the relative path unless the image file 7. If the looping animation is at the
and the .am file are not on the same beginning of the scene, then when
server, in which case this should be all the assets are loaded and are ready
the URL. If HTTPS is used, port 443 is to begin playing, the system will
used by default. To specify a different automatically stop looping and will
port, the URL must be followed by a continue playing the rest of the pre-
colon and a port number (e.g., sentation from that point. However,
https://www.anark.com:444). if the looping animation is at the end
of the scene, you will need to specify
3. On the Storage palette, select the
that the presentation should jump
PreBufferAsset behavior from the back so it can finish playing the rest
Miscellaneous folder on the Behavior of the scene. To tell the system where
Library tab and drag it onto the to jump back to, turn on Use Con-
Library palette. tinue Jump? by checking it and set a
4. Attach the PreBufferAsset behavior to value for Continue Time.
either the scene or the layer that con- 8. If the looping animation is at the end
tains the image object (or any other of the scene, you must drag the end
asset you want to load). It’s a good handle of the PreBufferAsset behav-
idea to place the start handle of the ior object past the last keyframe for
behavior at the beginning of the the animation.
project so it can begin prebuffering
immediately. 9. Set the Lib. Asset Name parameters to
the names of up to five resources in
5. In order to be sure that the default the Library.
image will not be displayed, a section
of the presentation will need to be 10. Clean out the Library by right-click-
looped while the system is prebuffer- ing in the Library and selecting
ing the assets. Turn on Use Buffer “Delete Unused Resources” from the
Loop? by checking it. Context menu.
Chapter 8
Working with Streaming Media and Dynamic Images
173
Anark_Studio_User_Guide.book Page 174 Monday, March 19, 2007 10:34 AM
Chapter 9
Viewing and Distributing Anark Media Files
Chapter 9
Viewing and Distributing Anark Media Files
Chapter 9
Viewing and Distributing Anark Media Files
Exporting to video
Chapter 9
Viewing and Distributing Anark Media Files
Chapter 9
Viewing and Distributing Anark Media Files
For projector files, double-click on the Note: Anark Player must be included
executable or application file.
with the Anark Media file, but does
For information about the file types that not have to be installed on the
are created with each of the export viewer’s computer. See “Preparing
formats, see “Exporting a presentation” Anark Media for a CD-ROM” on
on page 176. page 190 for more information.
Chapter 9
Viewing and Distributing Anark Media Files
or remotely sourced images are ration file to control some settings for
included in the presentation, you will the presentation. See “Command line
need to make those files available as and configuration file options
well. See “Chapter 8: Working with (Windows)” on page 192 for more
Streaming Media and Dynamic information. If any video, music or
Images” on page 165 for more remotely sourced images are included
information. in the presentation, you will need to
make those files available as well. See
For Web distribution, you will need to
“Distributing streaming media files”
place both the .am file and the .html
on page 169 for more information.
file on your Web server. If for some
reason you need to put the HTML and
.am files in different directories, you
Editing the HTML document
will have to edit the SRC parameter in When an Anark Studio presentation is
the HTML file with the Anark Media exported to HTML, the correct HTML
file’s new location using the guidelines tags are inserted into the HTML docu-
in “Editing the HTML document” on ment. These tags tell the viewer’s
page 184. If any video, music or browser what plug-in to use to run the
remotely sourced images are included specified presentation. Optional settings
in the presentation, you will need to are available to control some display
make those files available as well. See properties for the browser.
“Chapter 8: Working with Streaming Unless you need to store the .am file in a
Media and Dynamic Images” on different directory or on a different
page 165 for more information. server than the HTML file that is created
For Windows screen savers, you only during export, you don’t need to edit
any of the properties for the HTML tags,
need to provide the exported .scr file.
although you may want to change some
Including streaming files in screen
of the optional settings such as back-
savers is not recommended because of
ground color.
the very slow playback.
The HTML document must contain the
To distribute a video presentation, you <OBJECT> tags, including various param-
only need to provide the exported eters, that are required by Internet
video file. Explorer on Windows.
To distribute a projector file, just Refer to the following example to see
include the .exe file. Additionally, you which parameters must be included.
can set up a command line or configu-
Sample HTML object tags and parameters. tifier for Anark Client that the browser
uses to determine what application to
Required OBJECT attributes use to display the content. If you want
OBJECT NAME and ID are the name to distribute presentations that were
and ID of the Anark Client object. created in Anark Studio 3.5 or earlier in
They can be set to anything you want, Anark Client 4.0, you will need to
but when Anark Studio exports a change the CLASSID. See “Running
presentation it defaults to player. older presentations in Anark Client
Keep in mind that if you want to use 4.0” on page 186 for more informa-
the ActiveX control properties, you tion.
will need to refer back to whatever
OBJECT NAME you specified here. See WIDTH and HEIGHT can be set as
“Working with ActiveX control either a percentage of the browser
methods and properties” on page 189 window, frame or table cell (e.g.,
for more information. width = "100%" height = "100%")
or a specific pixel width (as shown).
CODEBASE will be set to the following This controls the width and height of
http://install.anark.com/client/ the Anark Client container window.
version4/windows-ie/en/
AMClient.cab#version=4,0,0,35607. SRC must be set to either the relative
It specifies the location of Anark Client path (if on the same server) or the URL
so that it can be downloaded if it is not (if on a different server) of the Anark
already available on the user’s Media file, which uses the .am exten-
computer. The version number (in this sion. Anark Media files that will be
case, 4,0,0,35607, although it will viewed exclusively on Windows
change with subsequent versions) can machines can also be loaded into the
be changed to a different version of HTML page using the load ActiveX
Anark Client. control function. See “Working with
ActiveX control methods and proper-
CLASSID must be set to ties” on page 189 for more informa-
CLSID:051D0E35-F4E3-4c8d-B411- tion.
AB0875F4C683. This is a unique iden-
Chapter 9
Viewing and Distributing Anark Media Files
Optional attributes for OBJECT tags and paste the content of the <OBJECT>
ScaleMode can be set to Free, Exact tag from the previous section into your
or Aspect. This controls the type of HTML file. You can edit or add any
window scaling that can be used. Free optional attributes you want. Make sure
allows scaling in any direction. Exact that the SRC parameter is set to either
disables scaling so that the presenta- the relative path or the URL of the Anark
tion only displays at an exact pixel size Media file.
and with the application border.
Tip: An easy way to copy the proper
Aspect allows scaling and always
maintains the aspect ratio. If you tags is to export the presentation to
change these values in the HTML HTML, open the generated HTML
document, they will override the Scale file with a text editor and copy the
Mode settings in Anark Studio. complete text of the <OBJECT> tag
from the generated file into your
PresWidth and PresHeight must be set existing HTML file. For more infor-
as a specific pixel width. These settings mation about exporting to HTML,
are only used if the ScaleMode has see “Exporting a presentation” on
been set to Fixed or Aspect. If you page 176.
change these values in the HTML
document, they will override the Running older presentations in
Presentation Size settings in Anark Anark Client 4.0
Studio. If you have existing presentations that
Splash specifies that a splash screen were created in Anark Studio 3.5 or
and progress bar will be displayed earlier and you want to distribute them
while the presentation loads. Defaults for playback in Anark Client 4.0, it’s a
to true. Set to false if you don’t want good idea to bring them into Anark
them to be displayed. Studio 4.0 first. Once they have been
saved and exported in Anark Studio 4.0,
BackgroundColor can be set to any they will automatically be ready for
standard HTML color string or to a distribution in Anark Client 4.0.
hexadecimal value (0xRRGGBB). This
However, if you don’t want to bring
setting only controls the color of the
them into Anark Studio 4.0 first, you can
splash screen that is displayed during
edit the CLASSID tag in the existing
loading.
exported HTML file. Simply change the
BorderColor can be set to any stan- old CLASSID (CLSID:131EB16C-BD58-
dard HTML color string or to a hexa- 443f-8151-6DFBB0DA1778) to the current
decimal value (0xRRGGBB). This setting CLASSID:
controls the color of the border 051D0E35-F4E3-4c8d-B411-
between the Anark Client container AB0875F4C683
and the presentation window.
Working with HTML events
Embedding Anark Media in an The Windows version of Anark Client
existing HTML file supports three HTML events:
If you want to embed the Anark Media onExternalCommand, onProgress and
file in an existing HTML file, just copy onStateChange.
HTML Events
Command Values Description
onExternal- ( commandString, Provides a connection point in the browser to which an Anark
Command parameterString ) Media file can send commands.
Example
The following would be entered in the HTML script:
<SCRIPT FOR="player" EVENT="onExternalCom
mand(command, value)" LANGUAGE="JavaScript">if
(command == "show alert")
{
alert(value);
}
</SCRIPT>
You would need to either create an External Command Action
using the instructions in “Creating and deleting actions” on
page 120, or you could create a behavior script that included
the following:
externalCommand( "show alert", "Howdy!" )
See the documentation of “externalCommand” on page 209
for more information about how to use externalCommand.
Please note, the internal and the external commands are dis-
abled unless you possess a valid license key. Please contact
your Anark sales representative for licensing information.
onProgress ( readyState, Provides a connection point for an Anark Media file to send
percentageCom- loading status information to the browser that can be used to
plete ) display a loading page or a loading status indicator.
The readyState value returns the current status of the loading
process:
0 = unknown state
1 = starting to load
2 = in progress
3 = complete
4 = loading error
Chapter 9
Viewing and Distributing Anark Media Files
HTML Events
Command Values Description
onState- ( newState ) Provides a connection point for Anark Client to send informa-
Change tion about its current state to the browser, which can use it to
find out whether Anark Client is ready to begin playing or
not.
0 = unknown state
1 = Anark Player is starting up
2 = Anark Player is playing
3 = Anark Player is paused
4 = fatal error
Example
The following would be entered in the HTML script:
<SCRIPT FOR="player"
EVENT="onStateChange( state )" LANGUAGE="JavaS-
cript">
if (state == 3)
{
alert( "Paused" );
}
</SCRIPT>
Chapter 9
Viewing and Distributing Anark Media Files
Preparing Anark Media for a For the majority of situations, you will
CD-ROM probably want to use projector files to
play Anark Media as a standalone appli- burning software with that particular
cation, on a CD-ROM or in a kiosk. You capability. A tutorial explaining how to
need to include both the Anark Media do this is available in the Knowledge
data and the Anark Player application Base on the Anark website.
that can display it in a single executable
file. Running a presentation on a CD-
When preparing an Anark presentation ROM automatically (Windows)
file for playback on a CD-ROM, consider 1. You’ll need to create an AutoRun file.
implementing Auto Run. AutoRun is a feature of the Microsoft
Windows operating system that
To do this, you set up an AutoRun file automatically runs an application on
using the instructions in “Running a the CD-ROM when it is inserted into
presentation on a CD-ROM automati- the drive. To create an AutoRun file,
cally (Windows)” on page 191. create a new document in any text
editing program (e.g., Wordpad,
Running a presentation on a Notepad, etc.) and name it
CD-ROM by double-clicking Autorun.inf. Add the following text
Do one of the following: to the file:
If you’re distributing your project as a [autorun]
projector file, simply place the OPEN=filename.exe
exported projector file (.exe) in the
desired directory on your CD-ROM. It [autorun.x86]
can be in the root directory or any OPEN=filename.exe
other directory.
If you’re distributing your project as an Replace filename.exe with the name
of the projector file you want to
Anark Player file, place the .am file
launch.
(which must be named index.am) and
the AMPlayer.exe in the desired direc- 2. Save the Autorun.inf file and place it
tory on your CD-ROM. It can be in the in the root directory of the CD-ROM,
root directory or any other directory. along with the .exe projector file.
If you want to customize Anark Player
Note: You can find more infor-
settings, you can create a configuration
mation about creating an AutoRun-
file (.cfg) in any text editing program
enabled CD-ROM on Microsoft’s
(e.g., Wordpad, Notepad, etc.) and name
developer Web site: http://
it Startup.cfg. Just include it in the direc-
msdn.microsoft.com/.
tory with the other files. Configuration
file settings are only used by the To customize the AutoRun file
Windows version of Anark Player. See (Windows):
“Setting up a configuration file for a You can add other command line
projector file” on page 195 for more options to the Autorun.inf file. For
information. example, the following commands
would run AMPlayer.exe in full screen
Creating hybrid CD-ROMs that will run mode and would not display a splash
on both Windows and Macintosh is a screen while loading:
specialized application that requires CD
Chapter 9
Viewing and Distributing Anark Media Files
Chapter 9
Viewing and Distributing Anark Media Files
Chapter 9
Viewing and Distributing Anark Media Files
Anark Client Context menu text and may contain graphics. All SCOs
The Anark Client Context menu is avail- must be able to communicate with an
able by right-clicking anywhere in an LMS.
Anark Media presentation. An LMS is a system that keeps learner
Restart – Restarts the currently loaded information, can launch and communi-
Anark Media file from the beginning. cate with SCOs, and can interpret
instructions that tell it which SCO
Pause/Play – If currently playing, then
comes next. When set up for SCORM
pauses the currently loaded Anark Media
conformance, an Anark Media presenta-
file. If currently paused, plays the
tion and its accompanying HTML page
currently loaded Anark Media file.
become a SCO. As such, they are able to
Rendering Engine – Controls how the communicate with the Application
currently loaded Anark Media presenta- Protocol Interface (API) provided by an
tion will be rendered. LMS, and issue two commands: LMSIni-
OpenGL – Uses OpenGL for rendering tialize and LMSFinish.
the scene. A JavaScript file, APIWrapper.js, which is
DirectX – Uses DirectX for rendering included with the Anark Studio down-
the scene. load, provides the link between the SCO
and the LMS.
Software – Uses software rendering.
The APIWrapper.js file is located in the
For a description of OpenGL, DirectX
Anark installation directory inside the
and Software, see “Setting application
Third-party/SCORM folder.
preferences” on page 17.
When you are ready to distribute your
Preferences – Opens the Anark Client
finished project, you must include three
Control Panel.
files: the Anark Media file, the HTML file
and APIWrapper.js.
Creating SCORM-conformant
To prepare a presentation for SCORM
presentations conformance:
SCORM (Sharable Content Object Refer- 1. Import the behavior SCORM.bvs into
ence Model) is a set of specifications and the project by dragging it from the
standards aimed at making learning Storage palette onto the Library pal-
content reusable, accessible and interop- ette. SCORM.bvs is located in the
erable. Anark Media presentations can Storage palette under Behavior Lib >
easily be made SCORM Version 1.2 Miscellaneous.
conformant (specifically, they are SCO-
2. Drag an instance of the SCORM
RTE1-conformant). Currently, SCORM-
behavior from the Library onto the
conformant Anark Media can only be
object that you want to have start the
viewed on Windows machines.
lesson. This could be either the Scene
SCORM has two essential parts: a or an object that will function as a
SCORM-conformant Learning Manage- start button.
ment System (LMS) and the learning
3. With SCORM selected in the
unit called a Sharable Content Object
Timeline, set the LMS Message
(SCO). A SCO is a standardized unit of
learning content that typically contains
Chapter 9
Viewing and Distributing Anark Media Files
Chapter 9
Viewing and Distributing Anark Media Files
Chapter 9
Viewing and Distributing Anark Media Files
203
Anark_Studio_User_Guide.book Page 204 Monday, March 19, 2007 10:34 AM
Chapter 10
Using Scripting
Overview of scripting
Anark Studio behavior scripts use JavaScript™. JavaScript, which conforms to the
ECMAScript standard, was developed by Netscape and Sun Microsystems as an open,
cross-platform scripting language for the Internet. It’s an object-oriented program-
ming language, organized into statements and comments. Objects in object-oriented
languages are defined as collections of properties, attributes of properties, and
methods (which are functions that are built into the object).
Using Anark Studio, you can create or import all of the built-in objects that are needed
for a project, such as layers, cameras, lights, groups, models and materials. You can
then attach behavior scripts to add interactivity or highly complex animation to the
objects in the project.
Scripting resources
Before you start writing scripts, you’ll need to be familiar with JavaScript terminology
and syntax. While this section of the manual provides an overview of the syntax and
terminology used in Anark Studio scripts, there are numerous in-depth JavaScript
tutorials available on the Web, and shelves of books have been written on the subject
as well.
Scripting syntax
Dot syntax
A period or dot (.) is used to indicate the properties or methods related to an object. It
can also be used to identify the path to a particular object. In the following example,
this.parent.position.z = -600; identifies the path to a property of this.parent (in
this case, the Z axis position).
this.parent.position.z = -600;
For more information about using this.parent, see “Using the parent property of a
behavior” on page 224.
Curly braces
Curly braces ({}) are used to group statements into blocks. Blocks are generally treated
as a single statement and are used to define functions and conditionals. In the
following example, the items in curly braces are treated as a part of the definition of
the function onMouseOver:
function onMouseOver( )
{
// Rotate the attached object.
this.parent.rotation.x += 5;
this.parent.rotation.y += 3;
this.parent.rotation.z += 1;
}
Scripting syntax
Equal sign
A single equal sign (=) is used to assign values to variables; it is the assignment oper-
ator. The variable to the left of the equal sign is assigned the value to the right of the
equal sign. In the following example, the Z axis position of fogCamera is set to -600.
scene.backgroundLayer.fogCamera.position.z = -600;
Two equal signs together are the equality operator (==), which is used to compare two
values to find out if they are equal. In the following example, this.value will be eval-
uated and, if it is exactly equal to 4, LoopMusic will be played. It does not assign the
value 4 to this.value.
if (this.value == 4)
{
LoopMusic.play();
}
Parentheses
Parentheses ( ) are used to contain arguments passed to functions and to override the
order of precedence for a set of expressions.
When calling a function, ensure that you always include the parentheses and any
required arguments. Calling a function without parentheses causes the text of the
function to be returned instead of the results of the function.
The following example uses the argument inEvent as a placeholder for all the data
collected during the onUpdate function.
function onUpdate( inEvent )
{
}
The following example shows how parentheses are used to change the order of prece-
dence. In this case, the 2+3 operation will be run before the value it returns is multi-
plied by 4:
var bob = ( 4 * (2+3));
Semicolons
Semicolons (;) are used to terminate statements, as in the following examples:
var mxp = Mouse.x;
this.parent.rotation.y += ( mxp - Mouse.x ) / 3;
With the exception of function definitions, use a semicolon after every line to be
executed.
Chapter 10
Using Scripting
For constructors (e.g., new Array, new Vector, etc.) the first letter of the object type
being created must be capitalized. For example:
this.mousePos = new Vector( Mouse.x - 40, -( Mouse.y - 30 ), 0 );
Comments
Comments make your scripts easier to read – even for yourself. Use them to add notes
to yourself or other programmers, and to document what you intended an action to
do. Comments can be specified in two ways. Any amount of text between /* and */ is a
comment. Also, any text between // and the end of the current line is a comment. For
example:
// this is a single line comment.
/* This is a multi-line
comment.*/
/*Here's another comment. */ // So is this.
Data types
JavaScript has just a few data types. Because JavaScript is loosely typed, a variable can
hold any data type and can be reassigned to a different data type at any time.
Numbers
Numbers can be specified as either an integer or a floating-point value. Internally,
JavaScript sees all numbers as floating-point numbers. Integers include positive and
negative whole numbers and 0. They can be specified as decimal, octal (prefixed by a
zero) or hexadecimal (prefixed by zero and a lower or upper case x).
Octal integers can only contain digits 0-7. Hexadecimal integers can contain digits 0-9
and the letters A-F (upper or lower case), which represent digits 10-15. Octal and hexa-
decimal numbers cannot be written in exponential notation.
Floating-point numbers are decimal integers followed by a period and the fractional
portion of the number. Exponential notation can be used by adding an e or E to the
end of a floating-point number followed by a decimal integer that does not exceed 3
digits.
Strings
A string is made up of any number of alphanumeric characters or spaces. Strings must
be declared by placing the characters in double quotes ("") or single quotes (' '). If one
type of quotation mark is part of the actual text, enclose the text in the other type of
quotation mark.
Boolean
The Boolean data type can only have two values: true or false. Boolean values are the
result of any comparison statement, and they are especially useful in conditional
statements.
Global functions
Null
The Null data type can have only one value: null. If a variable is assigned the value
null, then it has no valid data. This can be used to erase the contents of a variable
without deleting the variable. Unlike some other languages, null and 0 (zero) are not
the same value in JavaScript.
Undefined
The Undefined data type is returned whenever you use an object property that does
not exist or use a variable that has been created but has no assigned value.
Object
An object is a compound data type that contains any number of properties and
methods. Dot syntax (.) is used to access a named property or method of an object.
Array
An array is a compound data type that enables you to store multiple data, based on a
numbered position as in an index. The numbering of the index always starts at 0.
Global functions
The Anark Studio scripting environment includes several global functions that can be
called at any time in the script. Global functions provide a way to communicate
directly with the user via dialog boxes and alerts and provide a method for communi-
cating with the Web browser. They use different syntax than the built-in event
handler functions and user-defined functions in that they do not require that you use
the function keyword and may require some specific arguments.
Function Arguments Description
alert ( alertString ) Displays a message box containing the alertString text
and an OK button. It also causes a beep to sound.
Example
if ( this.parent.type == "Group" )
{
theParticle = theParticleGroup.models[0];
}
else if ( this.parent.type == "Model" )
{
alert("Cannot add this Behavior to a
model.");
}
Chapter 10
Using Scripting
Global functions
Chapter 10
Using Scripting
Keywords
Keywords
Assigned keywords
The following keywords have specific uses within the language, so they cannot be
used as variables, functions or labels (i.e., constants):
break do for null try
case delete function return typeof
catch else if switch var
continue eval in this void
debugger false instanceof throw while
default finally new true with
Reserved keywords
The following keywords are reserved for future uses:
abstract double goto native static
boolean enum implements package super
byte export import private synchronized
char extends int protected throws
class final interface public transient
const float long short volatile
Objects
Objects in JavaScript are collections of properties, attributes of properties and methods
(functions that are built into the object).
Chapter 10
Using Scripting
Operators
Operators
Operators are terms and symbols that are used to calculate a new value from one or
more values.
Arithmetic Operators
Symbol Operator Read from… Description
+ Addition L to R Adds the value of one numeric expression to another or
concatenates two strings.
-- Decrement R to L Decrements the value of a variable by one. If the operator
appears after the variable, the decrement is not per-
formed until after the expression has been evaluated. If
the operator appears before the variable, the decrement
is performed before the expression is evaluated.
/ Division L to R Divides the value of one expression by the value of
another.
++ Increment R to L Increments the value of a variable by one. If the operator
appears after the variable, the increment is not per-
formed until after the expression has been evaluated. If
the operator appears before the variable, the increment is
performed before the expression is evaluated.
% Modulus L to R Divides the value of one expression by the value of
another and returns the remainder.
* Multiplication L to R Multiplies the value of two expressions.
- Subtraction L to R Subtracts the value of one expression from another.
- Unary negation R to L Indicates the negative value of an expression.
Logical Operators
Symbol Operator Read from… Description
, Comma L to R Causes two expressions to be executed sequentially.
?: Conditional R to L Executes one of two statements depending on a
(ternary) condition.
== Equality L to R Compares two expressions to determine if they are equal.
> Greater than L to R Compares two expressions to determine if one is greater
than another.
>= Greater than or L to R Compares two expressions to determine if one is greater
equal to than or equal to another.
=== Identity L to R Compares the value of two expressions to determine if
they are equal in value or of the same data type.
!= Inequality L to R Compares the value of two expressions to determine if
they are unequal.
< Less than L to R Compares two expressions to determine if one is less
than another.
<= Less than or L to R Compares two expressions to determine if one is less
equal to than or equal to another.
&& Logical AND L to R Compares two expressions and, if and only if both return
TRUE, it returns TRUE; otherwise, it returns FALSE.
Chapter 10
Using Scripting
Logical Operators
Symbol Operator Read from… Description
! Logical NOT L to R Performs logical negation of an expression. If the expres-
sion evaluates to TRUE, it returns FALSE; if the expres-
sion evaluates to FALSE, it returns TRUE.
|| Logical OR L to R Compares two expressions and, if either or both evalu-
ates to TRUE, returns TRUE.
!== Nonidentity L to R Compares the value of two expressions to determine if
they are not equal in value or of the same data type.
Assignment Operators
Symbol Operator Read from… Description
= Assignment R to L Assigns the value of an expression to the right of the
operator to the variable on the left of the operator.
+= Addition R to L Adds the value of an expression to the value of a variable
Assignment and assigns the result to the variable.
/= Division R to L Divides the value of a variable by the value of an expres-
Assignment sion and assigns the result to the variable.
%= Modulus R to L Divides the value of an expression by the value of a vari-
Assignment able and assigns the remainder to the variable.
*= Multiplication R to L Multiplies the value of an expression by the value of a
Assignment variable and assigns the result to the variable.
-= Subtraction R to L Subtracts the value of an expression from the value of a
Assignment variable and assigns the result to the variable.
Keyword Operators
Operator Read from… Description
delete R to L Deletes a property from an object or removes an element from an
array.
instanceof R to L Returns a Boolean value that indicates whether or not an object is an
instance of a particular class.
new R to L Creates a new object.
typeof R to L Returns a string that identifies the data type of an expression.
void R to L Prevents an expression from returning a value.
hierarchy.
Create variable name “handles” for any object to make them easier to access.
Create and access utilities and miscellaneous objects that are not available in the
Anark Studio interface.
The following graphic outlines how nodes and assets can be attached and accessed:
This structure is very similar to the tree-view structure of the Object outline in the
Anark Studio interface. The primary difference, however, is that the full hierarchy
includes the “collections” of object types such as layers, cameras and groups. The
collections serve as access points to the hierarchy.
Chapter 10
Using Scripting
Note: Because JavaScript cannot access objects by name if they begin with a num-
ber, you should avoid naming any object that way. That includes the variable
name and the Library asset name.
An object created in scripting will not appear in the Object outline or anywhere else in
the Anark Studio interface. The object will appear in the scene only when the
behavior script is executed, which is when the F12 button is used or when the final
project is viewed. See “Distributing a presentation” on page 183 for more information
about viewing the project.
Not all objects that are accessible through scripting require a constructor, because they
are always available. These include the Scene, Window, Presentation, Key and Mouse.
In addition, the TimeContext object, which provides the clock for independent
groups, can only be created using the Anark Studio interface, although it can be
accessed through scripting.
For a complete list of the properties, methods, constructors and arguments for each
object type, see “ Scripting Object Reference” on page 243.
Using variables
It’s generally a good idea to create variable names for objects when you create them in
scripting. Variables are just conveniently named placeholders for whatever data you
assign to them. In scripting, variables are used to create easy-access handles for specific
objects, properties of objects or the values currently assigned to a property, and to set
the scope for them.
While you can create an object without creating a variable name for it, you would
only be able to address it through its parent tree. For example, you could create the
fogCamera with the following line.
new Camera ( "fogCamera", "myLayer" );
You would then have to walk down the hierarchy of objects in order to change any
property of fogCamera.
scene.myLayer.fogCamera.fov = 90;
Creating a variable name saves you from having to do this and also allows you to set
the scope of the object. If you create an object without a variable name, you can
always name it later to make it easier to access.
this.fogCamera = scene.myLayer.fogCamera;
Note: Using the this keyword defines the scope of the variable. For more informa-
tion about variable scope, see “Defining the scope of objects and variables” on
page 218.
More typically, you would create a variable name for the RedSpots model such as
this.spotsModel, so that you could access its properties more easily.
this.spotsModel.x = -300;
If, however, you gave any two different type objects the same name in the scene
graph, and you didn’t create a variable name for them, you would have to walk
through each collection of objects in addition to the instance names in order to get to
the particular object you want to reach. For example, if you named both a layer and a
group “backgroundGroup,” you would have to access each collection and object.
scene.layers.backgroundGroup.groups.backgroundGroup.position.z = -500;
Because this adds to the complexity of your code and makes it more likely that you
could confuse objects, giving different type objects the same name is not
recommended.
Likewise, if you gave more than one object of the same type the same name in the
scene graph without giving it a variable name (so that you could limit its scope), then
it would be difficult to specify which object you wanted to access. Doing so is not
recommended unless you are familiar with arrays and accessing objects through their
index numbers.
The process of walking down the scene hierarchy to address objects is analogous to
using an absolute path. Alternatively, you can use the parent property of objects to
Chapter 10
Using Scripting
create a relative path to an object. See “Using the parent property of a behavior” on
page 224 for more information.
Function scope
If a variable is created with function-level scope, it will be available only to the func-
tion that contains it. Function-level scope is created by using the var keyword.
var redBalls = 15
In this example, let’s assume that redBalls was created in an onMouseDown function.
You can now create another variable named redBalls in another function in this
behavior script and there would be no conflict between the two, thanks to the func-
tion-level scope.
Behavior scope
Creating variables with behavior-level scope is the equivalent of creating “class
objects” in JavaScript and C++.
Behavior-level scope is created by using the this keyword.
this.redBalls = 15
In this example, redBalls is now a global variable in this script and can be accessed
anywhere within it, no matter what function is being called, using the variable name
this.redBalls. When used this way, this refers back to the behavior object itself and
makes the variable into a property of the behavior script. This means that other scripts
can interact with the variable using the object model.
Note: There are a couple of exceptions to this rule. The three special event handlers
associated with the XML object (onLoadProgress, onLoadComplete and onLoad-
Error) operate differently. When inside a function that uses those event handlers,
the this keyword refers to the XML object instead of the behavior object. In
addition, when using the Execute Scriptlet action in the Anark Studio interface,
this refers to the object that is executing the action. For more information about
Scriptlets, see “Selecting an action” on page 125.
{
var theShells = global._collisionShells || ( global._collisionShells =
[]);
if ( this.parent.intersect )
{
theShells[ theShells.length ] = this;
}
Note: Loading Anark Playback Modules requires a valid license key. Please contact
your Anark sales representative for licensing information.
In scripting, an object created by any of the following methods is a dynamic object:
new Model();
Object.copy();
Object.load( "foo.am" );
The parent object to which the dynamic object is attached determines several features
of the dynamic object:
The duration of the dynamic object is the same as the duration of its parent.
If the parent is on a Master slide, then the dynamic object is also treated as being on
the same Master, and its properties are linked across all slides.
If the parent is not on a Master slide then the dynamic object is treated as being on
the current slide only.
Chapter 10
Using Scripting
However, if the dynamic object is inside a loaded component (i.e., inside a Playback
Module) then its Master/non-Master state is maintained from when it was exported
from Anark Studio.
Understanding functions
Understanding functions
Behavior scripts are made up of one or more functions, which are procedures that are
defined once and can be executed multiple times. Anark Studio scripting provides two
different types of built-in functions – global functions and event handler functions –
and you can also create your own functions.
Global functions allow you to do things like create HTML links, write simple alert
messages, communicate with the Web browser, and jump to a location in the presen-
tation, but they do not add true interactivity to the objects in a project. For more
information about them, see “Global functions” on page 207.
Event handler functions and user-defined functions are key elements of behavior
scripts because they provide the cues for the action and interactivity of the scene.
Creating functions
All nonglobal function declarations begin with the keyword function, followed by
the name of the function. Parentheses are placed after the function name to hold
arguments that are to be passed to the function. If more than one argument is needed,
use commas to separate them. Curly braces are used to contain the code related to the
function.
The following example uses some built-in event handler functions (onAttach, onUp-
date, onMouseDown and onMouseUp) and creates two new functions (Drag and
Drop). The built-in functions will be called either automatically by the system (onUp-
date) or based on user interaction (onMouseDown and onMouseUp), while the newly
created functions must be explicitly called in the script in order for them to be
executed. A newly created function must be immediately followed by parentheses
when called in the script [e.g., Drag ();]. Calling a function without parentheses
immediately thereafter causes the text of the function to be returned instead of the
results of the function.
For more information about the built-in event handler functions, see “Event handler
functions” on page 224.
function onAttach()
{
this.mousePos = new Vector;
if ( !this.moveGroup )
{
var theBehavior = this;
this.parent.detach( theBehavior );
}
if ( this.moveChildren )
{
var numModels = this.parent.models.length;
var theBehavior = this;
for ( i = 0; i < numModels; i ++)
{
Chapter 10
Using Scripting
this.parent.models[i].attach( theBehavior.copy() );
}
var numGroups = this.parent.groups.length;
for ( i = 0; i < numGroups; i ++)
{
this.parent.groups[i].attach( theBehavior.copy() );
}
}
}
function onUpdate()
{
//Make the object move if flag is true
if ( this.moving )
{
//Move object where mouse is - 400
this.parent.position.x = Mouse.x - 400;
//Move object where Mouse is - 300;
this.parent.position.y = -( Mouse.y - 300 );
//get Difference between subtracted mouse and real position of object
this.parent.position.subtract( this.mousePos );
}
}
function Drop( )
{
//Turn the onUpdate off
this.moving = false;
}
Creating functions
function onMouseDown( )
{
//Enables the Drag function
Drag();
if ( this.highlight )
{
var numMaterials = this.parent.materials.length;
for ( i = 0; i < numMaterials; i ++ )
{
this.parent.materials[ i ].emissivePower += 50;
this.parent.materials[ i ].diffuse.r += 150;
this.parent.materials[ i ].diffuse.g += 150;
this.parent.materials[ i ].diffuse.b += 150;
}
}
}
function onMouseUp( )
{
//Enables the Drop function
Drop();
if ( this.highlight )
{
var numMaterials = this.parent.materials.length;
for ( i = 0; i < numMaterials; i ++ )
{
this.parent.materials[ i ].emissivePower -= 50;
this.parent.materials[ i ].diffuse.r -= 150;
this.parent.materials[ i ].diffuse.g -= 150;
this.parent.materials[ i ].diffuse.b -= 150;
}
}
}
function onMouseOver( )
{
if ( this.highlight )
{
var numMaterials = this.parent.materials.length;
for ( i = 0; i < numMaterials; i ++ )
{
this.parent.materials[ i ].emissivePower += 50;
this.parent.materials[ i ].diffuse.r += 150;
this.parent.materials[ i ].diffuse.g += 150;
this.parent.materials[ i ].diffuse.b += 150;
}
}
}
Chapter 10
Using Scripting
function onMouseOut( )
{
if ( this.highlight )
{
var numMaterials = this.parent.materials.length;
for ( i = 0; i < numMaterials; i ++ )
{
this.parent.materials[ i ].emissivePower -= 50;
this.parent.materials[ i ].diffuse.r -= 150;
this.parent.materials[ i ].diffuse.g -= 150;
this.parent.materials[ i ].diffuse.b -= 150;
}
}
}
Note: When using the Execute Scriptlet action in the Anark Studio interface, par-
ent refers to the parent of the object that is executing the action. For more infor-
mation about Scriptlets, see “Selecting an action” on page 125.
The following chart contains a list of Anark Studio’s built-in event handler functions
and their associated properties. For more information about working with Event
objects to access event properties, see “Accessing event information” on page 229.
Function Type of Description Event Object
Event Properties
onUpdate Update The event handler executed every time the deltaTime – Accesses
scene is refreshed. The scene is updated a the amount of time in
maximum of 30 times per second on fast seconds since the scene
machines; on slower machines the refresh was last refreshed.
rate may be lower. This function has no
affiliation with objects or children. It is
executed continuously during playback.
onAttach Attach The event handler executed when a behav- object – A reference to
ior is attached to an object. the object that was
attached.
onDetach Attach The event handler executed when a behav- object – A reference to
ior is detached from an object. the object that was
detached.
onBuffered Media The event handler executed when a music, object – A reference to
video or image file has loaded enough the music, video or
information to make it ready to play or dis- image file that is being
play, but is not yet completed. For music or buffered.
video buffering, the behavior script that
uses this event handler must be attached to
the Scene object. For image buffering, it
must be attached to either the Scene or the
Material object.
onMediaError Media The event handler executed when a music object – A reference to
or video file cannot properly load. the music or video file
that failed to load.
onMediaCom- Media The event handler executed when a music object – A reference to
plete or video file has finished playing. the music or video file
that is finished play-
ing.
onLoadProgress Loading The event handler fired continuously as a object – A reference to
Playback Module is loading. the object that is load-
ing the Playback Mod-
ule.
percentDone –
Accesses the propor-
tion of a Playback
Module that has com-
pleted loading. Range =
0 - 1.
loadSource – The URL
or file name of the file
being loaded.
Chapter 10
Using Scripting
Chapter 10
Using Scripting
Note: The onCommand event is handled differently from the other event handlers
and is documented in “Using the onCommand function” on page 233.
Every AKEvent object has a name property, which is just the name of the event
handler function that was executed. In addition, some event handler functions may
have several other properties that can be accessed. For a complete list of the available
properties, see “Event handler functions” on page 224.
Chapter 10
Using Scripting
Cancelling bubbling
In the following example, the only way to make a model glow would be to attach the
behavior to each and every model you wanted to glow.
function onMouseOver( )
{
this.parent.materials[0].emissivePower = 100;
}
function onMouseOut( )
{
this.parent.materials[0].emissivePower = 0;
}
Using the Event object, the behavior could be attached to a group or even to a layer to
make any model glow when it receives a mouseOver event.
function onMouseOver( inEvent )
{
inEvent.object.materials[0].emissivePower = 100;
}
Cancelling bubbling
There may be occasions when you need to turn off event bubbling. For example, you
might want to enable the user to drag a specific object without also dragging the
parent object. If you have the following object hierarchy:
MyGroup
Draggable.bvs
ChildModel
Draggable.bvs
You can ensure that only ChildModel starts dragging when it receives an
onMouseDown event by preventing the onMouseDown event from bubbling up the
hierarchy. To do this, you need to write an event handler that specifically returns false
Chapter 10
Using Scripting
(as opposed to specifying no return value, which returns undefined) to cancel event
bubbling.
function onMouseDown( )
{
// Start dragging the object
this.startDragging( );
// Cancel bubbling so no ancestor starts dragging
return false;
}
A slightly more complex example would achieve the same goal:
function onAttach( )
{
registerForEvent( this.parent, "onMouseDown", this.startDragging );
}
Note: The internal and the external commands are disabled unless you possess a
valid license key. Please contact your Anark sales representative for licensing
information.
Chapter 10
Using Scripting
Frozen objects do send and receive other events and they execute actions, although no
visual changes are made to a frozen object until it is unfrozen.
There are a couple of ways to “melt” a frozen object:
If you want the object to be updated continuously again, you can set the frozen
property back to false.
If you want the object to melt for a single update cycle you can use the meltOnce
method. This will unfreeze the asset and all its descendants during the next update
only, and then revert to the frozen state for subsequent frames. Note, however, that
the frozen property will remain true for the asset even during the update frame.
While frozen objects aren’t available for user interaction, there is a way to enable
them to respond to events and then go immediately back to their static state. To
unfreeze an asset for a single update cycle based on user interaction or another
event, you can use the registerMeltOnce method. It allows you to register a frozen
object for one or more events, including custom events. When the event is fired, the
object and all of its descendants will be unfrozen for a single update cycle. As with
the meltOnce method, the frozen property will remain true for the objects even
during the update frame.
Unfreezing objects for a single frame based on user interaction or a condition being
met in a behavior script allows you to optimize playback while maintaining access to
frozen assets when needed. A good example of this would be changing the fabric on
the seats inside an airplane. The seats could be frozen until the user clicked on a fabric
swatch. Their attached materials could be updated during the next frame, and they
would then revert back to their frozen state.
if
An if statement tests a condition, and if the condition meets the test, the appropriate
statement is executed. If the condition doesn’t meet the test, the statement is skipped.
A simple if statement looks like this:
if (condition)
statement;
In the following example, the name parameter of the object to which the behavior
script is attached is evaluated and, if it is “A,” the endZ variable is set to 0.
function onAttach( inEvent )
{
if (inEvent.object.name == "A")
{
this.endZ = 0;
}
}
if/else
An if/else statement tests a condition and, if the condition meets the test, one
statement or block is executed; if the condition fails the test, a different statement or
block is executed.
A simple if/else statement has the following syntax:
if (condition)
statement;
else
statement;
In the following example, the name parameter of the object to which the behavior
script is attached is evaluated and, if it is “A,” the endZ variable is set to 0; if it is not
“A” then endZ is set to 1.
function onAttach( inEvent )
{
if (inEvent.object.name == "A")
{
this.endZ = 0;
}
else
{
this.endZ = 1;
}
}
switch
A switch statement executes one or more statements based on whether a given
expression’s value matches a constant (as opposed to a variable). These statements are
commonly used to test all the possible results of an expression. The basic syntax of
switch statements is the following:
switch (expression)
{
case constant1:
statement1;
break;
case constant2:
statement2;
break;
default:
break;
}
The switch statement begins by evaluating an expression placed between paren-
theses. The result is then compared to constants associated with case structures that
follow. If the result is equal to the constant, the statement(s) in the corresponding
Chapter 10
Using Scripting
case structure are executed. A default structure can be used at the end of a switch
structure to catch results that do not match any of the case labels. A colon always
follows a label. The keyword break is used to break out of the entire switch state-
ment once a match is found.
function onChar (inEvent)
{
switch (inEvent.keyChar)
{
case 'A':
amodel.visible = true;
break;
case 'B':
bmodel.visible = true;
break;
case 'C':
cmodel.visible = true;
break;
default:
staticgroup.visible = true;
break;
}
}
Using loops
Loops let you specify that a statement or block be executed repeatedly as long as a
condition is met. It is easy to accidentally create endless loop behaviors, so unless that
is your intention, be cautious when writing loop statements.
for
A for loop provides a structure for looping a statement or block of statements a
limited number of times. The basic syntax of for loops is the following:
for (initialize; condition; adjust)
{
statement;
}
The initialize expression sets a starting value for the loop and often declares a variable
to contain the value. The condition expression sets how many times the loop will be
iterated. The adjust expression determines how the variable, which was initialized in
the first part, should be changed each time the loop is iterated. The keyword break
can also be used to break out of a for loop. The keyword continue can be used to
force the execution of the code to continue at the beginning of the loop.
function Opacity ()
{
for (var modelIndex = 0; modelIndex < parent.models.length; modelIndex++)
{
parent.models[modelIndex].opacity = 50;
}
while
A while loop provides a less restrictive structure for looping than for loops because it
doesn’t require a limit for the number of times the code will execute. While it allows
you to write more complex conditions than for loops, it also makes it easy to write an
infinite loop, so make sure you include a way for the condition to be updated so the
loop will be able to end.
The basic syntax of while loops is the following:
while (condition)
{
statement;
}
If the condition evaluates to true, then the statement will be executed. Because the
condition is evaluated before the statement is executed, if the expression returns false,
the statement may never be executed and the loop will never start.
function Rise ()
{
var modelNum = 0;
while(modelNum <=10)
{
this.parent.position.x += 5;
modelNum++;
}
}
do…while
The do…while loop works only slightly differently than the while loop in that it
executes the statement before evaluating the condition. This means that the
statement will always be executed at least once. The basic syntax of do…while loops is
the following:
do
{
statement;
}
while (condition);
Chapter 10
Using Scripting
{
this.parent.position.x += .03;
}
Each time the scene is redrawn, this function accesses the current value of the X posi-
tion of the object this script is attached to and increments it by .03.
The following function would override any animation settings for the same property:
onUpdate ( )
{
this.parent.position.x = this.value;
this.value += .03;
}
While this function also increments the X position of the object by .03, it does so by
first overriding the current setting for the object by setting it to this.value, which it
then increments by .03.
Chapter 10
Using Scripting
Object Reference
241
Anark_Studio_User_Guide.book Page 242 Monday, March 19, 2007 10:34 AM
Anark_Studio_User_Guide.book Page 243 Monday, March 19, 2007 10:34 AM
Scripting
Object
Scripting Object Reference Reference
243
Anark_Studio_User_Guide.book Page 244 Monday, March 19, 2007 10:34 AM
Chapter 12
Scripting Object Reference
Asset
The Asset object is the base class of all nonutility classes within the Anark Studio
system. Examples of assets include Image, Material and all Nodes. Assets have the
power to make copies of themselves, as well as have Behaviors attached for interac-
tivity. You can create dynamic properties for assets using dot syntax. Assets have the
following properties and methods:
Asset Properties
id Returns the unique numeric identifier for this asset.
type Returns the type name for this asset. For example “Image.”
name The user-defined name for this object.
parent Returns the parent object to which this asset belongs.
behaviors Returns the collection of Behavior objects attached to this asset.
sounds Returns the collection of Sound objects attached to this asset.
music Returns the collection of Music objects attached to this asset.
context Returns this asset’s local TimeContext object.
active A Boolean flag that specifies whether this asset and its children should be
rendered in the scene as needed. If the flag is false, neither the asset nor any
of its children will be drawn in the scene. Defaults to true.
frozen A Boolean flag that specifies whether or not the object and its descendants
will be updated for rendering. Unlike an object that is inactive, frozen objects
are still rendered, but their properties are not updated. Keyframed animation
and changes made to frozen objects based on interactivity are calculated but
not rendered. If a frozen object is later unfrozen, it will jump to the appropri-
ate value. This property can be used to increase frame rates for presentations
that have a large number of static objects.
startLifeTime Returns the starting time in seconds of the asset according to its timebar in
the Timeline tab.
endLifeTime Returns the ending time in seconds of the asset according to its timebar in
the Timeline tab.
Asset
Asset Methods
attach Attaches an asset (e.g., a node, behavior, image, etc.) to the asset. If the
attached asset is a behavior, it also begins execution.
Syntax
asset.attach ( assetObject )
Arguments
assetObject
The Asset object that will be attached.
detach Removes a previously attached asset from the asset.
Syntax
asset.detach ( assetObject )
Arguments
assetObject
The Asset object that will be detached.
copy Creates a copy and returns a new asset.
Syntax
asset.copy ( )
Arguments
N/A
fireEvent Executes the specified event. The fireEvent method, together with the
AKEvent object, allows you to create and execute custom events in scripting.
Syntax
asset.fireEvent ( eventObject )
Arguments
eventObject
The AKEvent object that was being listened to.
load Loads the specified .am file and attaches it as a child of the asset. The .am file
must be a component that was exported as a Playback Module. See “Export-
ing and importing components” on page 60 for more information.
Please note, loading Anark Playback Modules requires a valid license key.
Please contact your Anark sales representative for licensing information.
A component that has been loaded using this method is a dynamic object.
Several important features of dynamic objects are controlled by their parents.
See “Understanding dynamic objects” on page 219.
Syntax
asset.load ( inURL, noBufferSharing )
Arguments
inURL
The URL of the .am file to load. For Web delivery, only HTTP or HTTPS proto-
cols can be used. If HTTPS is used, port 443 is used by default. To specify a
different port, the URL must be followed by a colon and a port number (e.g.,
https://www.anark.com:444). If you use backslashes when specifying the
URL, they must be escaped. See “Specifying paths in scripting” on page 212
for more information.
noBufferSharing
Optional. When set to true, specifies that the heavy buffer data from the
Playback Module being loaded will not be shared. Defaults to false.
Chapter 12
Scripting Object Reference
Asset Methods
meltOnce For assets that have been frozen, this method will cause the asset and all its
descendants to unfreeze during the next update only, and then revert to the
frozen state for subsequent frames. During the single unfrozen frame, the fro-
zen property of the assets will still have the value true. This method can be
used on an asset even if one of the asset’s ancestors has been frozen.
registerMelt- For assets that have been frozen, this method will unfreeze the asset for one
Once frame when the listened for event is fired. The unfreezing behaves identically
to the meltOnce method.
The event that unfroze the asset also fires for the asset during the unfrozen
update. This means that any event handlers for the asset will be executed
during the update frame.
Syntax
asset.registerMeltOnce ( Event )
Arguments
Event
The event to be listened for. Any event can be specified, including custom
events. More than one event can be specified.
Example
theAsset.registerMeltOnce ( "onMouseDown", "onMouseOver" );
unregisterMelt- For assets that have been set up to melt once using the registerMeltOnce
Once method, this method allows the asset to stop listening for the event.
Syntax
asset.unregisterMeltOnce ( Event )
Arguments
Event
The event to stop listening for. Multiple events can be specified; if no events
are specified, then the asset will stop listening for all events.
Asset Examples
// Make a copy of an existing image.
theImageCopy = theImage.copy();
Scene
Scene
The scene is the root object, forming an access point to query for data. The scene’s
primary property is an ordered list of Layer objects that forms the description of all
information to be drawn to the screen. It has no constructor because it is always
available.
The scene is different from other assets in that it only shares a few of the properties
and methods of assets, as listed in “Asset Properties” and “Asset Methods” on
page 245. The scene only has the id and type properties and the attach and detach
methods. The attach and detach methods only work with layers when used with the
Scene object. In addition, the scene has the following object properties and methods:
Scene Properties
layers Returns the collection of layers that are a part of this scene.
presentation Returns the currently active Presentation object.
(deprecated)
background- Sets the background color for the scene.
Color
Scene Methods
clear Removes all layers from the scene.
Scene Example
// Set the location of the box on a
// particular layer.
scene.layers[0].models.Box.position.x = 100;
Behavior
A Behavior object is a type of asset and represents a collection of scripting statements
that control the behavior of objects in a presentation. Behaviors can only be created
using the Anark Studio interface by either creating a new empty behavior asset and
editing it in the scripting interface, or by importing an existing text file with a .bvs
extension. Behaviors may be attached to any object in the scene.
Behaviors have all the properties and methods of assets, as listed in “Asset Properties”
and “Asset Methods” on page 245. In addition, behaviors have the following object
methods:
Chapter 12
Scripting Object Reference
Behavior Methods
registerForEvent Allows the object to which this behavior is attached to listen for an event on
another object in the scene. When the event occurs, the specified function
will be executed. If the behavior is detached from its parent, all callbacks reg-
istered using this method will automatically be unregistered.
Syntax
registerForEvent ( inAsset, "inEventName", function )
Arguments
inAsset
The asset that will be listened to.
inEventName
The event to be listened for.
function
The function to be executed.
unregisterFor- Allows the object to which this behavior is attached to stop listening for an
Event event it has previously registered for.
Syntax
unregisterForEvent ( inAsset, "inEventName", function )
Arguments
inAsset
The asset that was being listened to.
inEventName
The event that was previously registered for.
function
The function that was to be executed.
Behavior Examples
function onAttach()
{
this.line = "hello world!";
registerForEvent( this, "onSomething", doSomething );
registerForEvent( Scene, "onMouseDown", onSceneMouseDown );
}
fireEvent( theEvent );
}
Material
Material
The Material object is a type of asset that represents the surface of a model and is
applied on a per-triangle basis to the geometry.
The scripting object constructor creates an empty Material object. Objects created via
scripting are not available to the Anark Studio interface, but they do appear in the
finished project.
Scripting object constructor syntax
var theMaterial = new Material ( "sceneGraphName", attachToObject )
Return value
Returns the new material.
Arguments
sceneGraphName
Optional. The name of the material in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the material will be attached. The material must be
attached to a model either now or later in order to appear in the scene during
playback.
Materials have all the properties and methods of assets, as listed in “Asset Properties”
and “Asset Methods” on page 245. In addition, materials have the following object
properties and methods:
Material Properties
maps Returns the collection of images attached as maps to this material.
specularEnable This is a Boolean flag indicating that specularity should be represented on
this surface.
specularPower This is a value ranging from 0 to 100 representing the sharpness of the specu-
larity. 100 creates a very tight specular highlight. Defaults to 0.
opacity This is a value between 0 and 100, representing the opacity of the object. 100
is completely opaque. Defaults to 100.
culling This property has three possible values representing the type of culling to
perform on this object:
0 = None.
1 = CounterClockwise. Removes the back face of the polygons so that only
the exterior of the material is displayed.
2 = Clockwise. Removes the front face of the polygons so that the interior of
the material is displayed rather than the exterior.
specular The color of the specularity of this material.
diffuse The color of the diffuse color of this material.
ambient The color of the ambient color of this material.
emissivePower Specifies the intensity of the emissive property of the material. An emissive
material appears to give off its own light.
Chapter 12
Scripting Object Reference
Material Properties
fillMode Specifies whether the object to which this material is attached should be dis-
played as a wireframe, solid or with points for the vertices. Defaults to Solid
(0).
0 = Solid
1 = Wireframe
2 = Point
blendMode Controls how the pixels of this material blend with the pixels of the rest of
the scene. Blending modes are based on mathematical operations that com-
pare the color values of the pixels of this material (the blend color) with the
color values of the pixels of whatever else is in the scene that intersects this
material (the base color). The opacity of the different materials will also affect
the results of the blending mode. For a description of the different blending
modes, see “Setting properties for materials” on page 100.
0 = Normal
1 = Screen
2 = Multiply
3 = Overlay
4 = Bleach
5 = Ghost
6 = Saturate
Material Examples
// Create a new material.
theMaterial = new Material( "greenSpots", theModel );
theMaterial.opacity = 0.5;
Image
The Image object is a type of asset that is used for texture maps included in a material
description. An image can encapsulate a single picture or can be used to load a series
of pictures, allowing for extremely powerful texture mapping behavior.
The scripting object constructor creates an empty Image object. Objects created via
scripting are not available to the Anark Studio interface, but they do appear in the
finished project.
Scripting object constructor syntax
var theImage = new Image ( "sceneGraphName", attachToObject )
Return value
Returns the new image.
Arguments
sceneGraphName
Optional. The name of the image in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the image will be attached. Images can only be
attached to materials. The image must be attached to a material either now or later in
order to appear in the scene during playback.
Image
Images have all the properties and methods of assets, as listed in “Asset Properties”
and “Asset Methods” on page 245. In addition, images have the following object
properties:
Image Properties
height The read-only height of the image in pixels.
width The read-only width of the image in pixels.
visible The flag indicating that this image should be rendered when necessary.
When set to false, this image will never appear in any material. Defaults to
true.
remoteSource Sets a URL for a JPEG or PNG image file or the fully qualified absolute or rela-
tive path to it. See “ Understanding paths for streaming media and dynamic
images” on page 166 for more information about specifying the Remote
Source property. Additionally, if you use backslashes when specifying the
URL, they must be escaped. See “Specifying paths in scripting” on page 212
for more information.
rotation Sets the rotation of this image in degrees. Defaults to 0.
positionU Sets the horizontal offset of this image in normalized units (0 to 1.0). Adjust-
ing this will slide the image horizontally. A setting of .5 moves the image
over by half of its distance. A setting of 2 moves the image over by twice its
distance, which would mean that it is no longer displayed unless tilingMode-
Horiz has been enabled.
positionV Sets the vertical offset of this image in normalized units (0 to 1.0). Adjusting
this will slide the image vertically. A setting of .5 moves the image over by
half of its distance. A setting of 2 moves the image over by twice its distance,
which would mean that it is no longer displayed unless tilingModeVert has
been enabled.
pivotU Sets the horizontal location of the pivot point of the image on the object.
Because the pivot point is calculated in global space, a positionU offset must
also be set in order to see a difference in the pivot point in the local space of
the image. If the PivotU and PivotV are set to 0, then the pivot point is
located in the bottom left hand corner of the model. Specified in values
between 0 and 1.0.
pivotV Sets the vertical location of the pivot point of the image on the object.
Because the pivot point is calculated in global space, a positionV offset must
also be set in order to see a difference in the pivot point in the local space of
the image. If the pivotU and pivotV are set to 0, then the pivot point is
located in the bottom left hand corner of the model. Specified in values
between 0 and 1.0.
repeatU Sets the horizontal scale of this image when applied as a texture map so that
it can be repeated on the model (using tiling). Defaults to 1.0.
repeatV Sets the vertical scale of this image when applied as a texture map so that it
can be repeated on the model (using tiling). Defaults to 1.0.
tilingModeHo- Sets the horizontal tile mode of this image when used as a texture map.
riz 0 = Repeat
1 = Repeat with mirror
2 = No tiling
Chapter 12
Scripting Object Reference
Image Properties
tilingModeVert Sets the vertical tile mode of this image when used as a texture map.
0 = Repeat
1 = Repeat with mirror
2 = No tiling
materialMode Controls how the image is mapped to the material. This is the equivalent of
Texture Type in the Anark Studio GUI. For a description of the different
material modes, see “Setting properties for images” on page 104.
0 = Diffuse Map
1 = Opacity Map
2 = Specular Map
3 = Emissive Map
4 = Light Map
5 = SuperCharge Map
6 = Negative Map
mappingMode Controls the way the image is wrapped around or projected onto the object.
This is the equivalent of Texture Mapping in the Anark Studio GUI. For a
description of the different mapping modes, see “Setting properties for
images” on page 104.
0 = UV Mapping
1 = Camera Projection
2 = Object Projection
3 = Environmental Mapping
mipmapMode Sets the sampling level of mipmapping done on the image.
0 = None
1 = Bi-linear
2 = Tri-linear
3 = Tri-linear Anisotropic
mipmapLOD- Sets the LOD range of the mipmap sampling. Values can be between -3.00
Bias and 3.00.
anisotropyDe- Gets or sets the level of anisotropy to use on the image when in Tri-linear
gree Anisotropic mode.
0 = Off
1 = Low
2 = Medium
3 = High
Image Examples
// Create a new image.
var theImage = new Image ( "Brick", theMaterial );
// Set a remote source for the image.
theImage.remoteSource = ./Textures/brick.jpg
// Repeat the image.
theImage.repeatU = 2;
theImage.repeatV = 2;
Video
Video
The Video object is a type of asset that encapsulates a video file, which may contain a
snippet of a video or even an entire movie.
The scripting object constructor creates an empty Video object. Objects created via
scripting are not available to the Anark Studio interface, but they do appear in the
finished project.
Scripting object constructor syntax
var theVideo = new Video ( "sceneGraphName", attachToObject )
Return value
Returns the new video.
Arguments
sceneGraphName
Optional. The name of the image in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the video will be attached. Videos can only be attached
to layers or to materials. The video must be attached to a material either now or later
in order to appear in the scene during playback.
Videos have all the properties and methods of assets, as listed in “Asset Properties”
and “Asset Methods” on page 245. In addition, videos have the following object prop-
erties and methods:
Video Properties
volume Sets the volume of the video’s audio. Values can be between 0 and 100.
Defaults to 90, which is 90% of the loudest setting enabled on the end user’s
system.
balance The left to right balance of the video audio. Values can be between -100 and
100. Defaults to 0.
loop Sets whether the video will continuously loop. Defaults to true.
remoteSource Sets and returns either the URL of the video file or the fully qualified absolute
or relative path to it. See “Understanding paths for streaming media and
dynamic images” on page 166 for more information about specifying the
Remote Source property. Additionally, if you use backslashes when specifying
the URL, they must be escaped. See “Specifying paths in scripting” on
page 212 for more information.
buffered Returns a Boolean flag indicating whether or not the video file is buffered
and ready to begin playing.
height The read-only height of the video in pixels.
width The read-only width of the video in pixels.
visible The flag indicating that this video should be rendered when necessary. When
set to false, this video will never appear in any material. Defaults to true.
rotation Sets the rotation of this video in degrees. Defaults to 0.
Chapter 12
Scripting Object Reference
Video Properties
positionU Sets the horizontal offset of this video in normalized units (0 to 1.0). Adjust-
ing this will slide the video horizontally. A setting of .5 moves the video over
by half of its distance. A setting of 2 moves the video over by twice its dis-
tance, which would mean that it is no longer displayed unless tilingModeHo-
riz has been enabled.
positionV Sets the vertical offset of this video in normalized units (0 to 1.0). Adjusting
this will slide the video vertically. A setting of .5 moves the video over by half
of its distance. A setting of 2 moves the video over by twice its distance,
which would mean that it is no longer displayed unless tilingModeVert has
been enabled.
pivotU Sets the horizontal location of the pivot point of the video on the object.
Because the pivot point is calculated in global space, a positionU offset must
also be set in order to see a difference in the pivot point in the local space of
the video. If the PivotU and PivotV are set to 0, then the pivot point is
located in the bottom left hand corner of the model. Specified in values
between 0 and 1.0.
pivotV Sets the vertical location of the pivot point of the video on the object.
Because the pivot point is calculated in global space, a positionV offset must
also be set in order to see a difference in the pivot point in the local space of
the video. If the pivotU and pivotV are set to 0, then the pivot point is
located in the bottom left hand corner of the model. Specified in values
between 0 and 1.0.
repeatU Sets the horizontal scale of this video when applied as a texture map so that
it can be repeated on the model (using tiling). Defaults to 1.0.
repeatV Sets the vertical scale of this video when applied as a texture map so that it
can be repeated on the model (using tiling). Defaults to 1.0.
tilingModeHo- Sets the horizontal tile mode of this video when used as a texture map.
riz 0 = Repeat
1 = Repeat with mirror
2 = No tiling
tilingModeVert Sets the vertical tile mode of this video when used as a texture map.
0 = Repeat
1 = Repeat with mirror
2 = No tiling
materialMode Controls how the video is mapped to the material. This is the equivalent of
Texture Type in the Anark Studio GUI. For a description of the different
material modes, see “Setting properties for images” on page 104.
0 = Diffuse Map
1 = Opacity Map
2 = Specular Map
3 = Emissive Map
4 = Luminosity Map
Music
Video Properties
mappingMode Controls the way the video is wrapped around or projected onto the object.
This is the equivalent of Texture Mapping in the Anark Studio GUI. For a
description of the different mapping modes, see “Setting properties for
images” on page 104.
0 = UV Mapping
1 = Camera Projection
2 = Object Projection
3 = Environmental Mapping
Video Methods
startBuffering Connects to the specified remoteSource for the video file and begins buffer-
ing it.
play Sets the video to start playing.
pause Pauses the video.
stop Stops playback of the video.
seek If the video is currently playing, this method repositions the video to this
location and continues playing. If the video is stopped or paused, this
method repositions the video to this location but doesn’t begin playing until
set to play again. Specified in seconds. This only works with high quality, low
compression formats; high compression formats such as MPEG-4 and .wmv
do not support seeking.
Syntax
video.seek ( position )
Arguments
position
The time in seconds that specifies how far into the video to seek.
Video Examples
// Create a new video and attach it to a material.
var theMovie = new Video ( "Rain", blueMaterial );
// Set a remote source for the video.
theMovie.remoteSource = "./Videos/Rain.mpg";
theMovie.volume = 80;
theMovie.loop = true;
Music
A Music object is a type of asset, that encapsulates a specific song or music clip.
Currently, Music objects may be loaded from .mp2 and .mp3 files.
New music objects can be created via scripting. The scripting object constructor
creates an empty Music object. Objects created via scripting are not available to the
Anark Studio interface, but they do appear in the finished project.
Scripting object constructor syntax
var theMusic = new Music ( "sceneGraphName", attachToObject )
Return value
Returns the new music object.
Chapter 12
Scripting Object Reference
Arguments
sceneGraphName
Optional. The name of the music object in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the music will be attached. The Music object must be
attached to another object in the scene either now or later in order to appear in the
scene during playback.
Music objects have all the properties and methods of assets, as listed in “Asset Proper-
ties” and “Asset Methods” on page 245. In addition, Music objects have the following
object properties and methods:
Music Properties
volume The volume of the music. Values can be between 0 and 100. Defaults to 100,
which is 100% of the loudest setting enabled on the end user’s system.
loop Sets the music to continuously loop. Defaults to true.
balance The left to right balance of the music. Values can be between -100 and 100.
Defaults to 0.
duration Returns the length of the music in seconds.
remoteSource Sets and returns either the URL of the music file or the fully qualified abso-
lute or relative path to it. See “Understanding paths for streaming media and
dynamic images” on page 166 for more information about specifying the
Remote Source property. Additionally, if you use backslashes when specifying
the URL, they must be escaped. See “Specifying paths in scripting” on
page 212 for more information.
buffered Returns a Boolean flag indicating whether or not the music file is buffered
and ready to begin playing.
Music Methods
startBuffering Connects to the specified remoteSource for the music file and begins buffer-
ing it.
play Starts playing the music.
pause Pauses the music.
stop Stops the music.
seek If the music is playing, repositions to the given location within the music
and continues playing. If the music is stopped or paused, repositions to the
given location but doesn’t begin playing until set to play again. This method
is only valid when the buffered property is true. Specified in seconds.
Syntax
music.seek ( position )
Arguments
position
The time in seconds that specifies how far into the music to seek.
Node
Music Examples
// Create a new music object and attach it to the PlayButton component.
var theMusic = new Music ( "Song", PlayButton );
// Set a remote source for the video.
theMusic.remoteSource = ./Tracks/Song.mp3
theMusic.volume = 80;
Node
Nodes encompass all objects that may be attached to the layers in the scene. Nodes
include: Layer, Camera, Light, Group, Model, Text and Sound. All objects that are
types of nodes have the following properties and methods, allowing them to be placed
in the scene and their position and rotation manipulated.
Node Properties
position The three-element vector describing the location of the object in X, Y and Z.
rotation The three-element rotation describing the rotation of the object about the
primary axes X, Y and Z.
scale The three-element vector describing the scale of the object along the primary
axes X, Y and Z.
pivot The three-element vector describing the location of the pivot point of the
object in X, Y and Z.
cameras Returns the collection of Camera objects attached to this node.
groups Returns the collection of Group objects attached to this node.
lights Returns the collection of Light objects attached to this node.
models Returns the collection of Model objects attached to this node.
text Returns the collection of Text objects attached to this node.
opacity Adjusts the transparency of both the node and all the objects attached to the
node. The opacity of nodes has a multiplicative relationship. This means that
if a model has an opacity value of 50%, its parent group has an opacity value
of 80%, and the parent layer has an opacity value of 50%, the model will
actually appear to have an opacity of 20% (50% x 80% x 50% = 20%). If the
opacity is set to 0, the object will be drawn in the scene, but will be invisible.
lastGlobalTrans- Returns a matrix object describing the object’s position, scale, pivot and rota-
form tion in global space the last time the scene was updated.
positionVeloc- The three-element vector describing the velocity of the movement of the
ity object in X, Y and Z. Specified in units per second.
rotationVelocity The three-element vector describing the velocity of the rotation of the object
in X, Y and Z. Specified in degrees per second.
Chapter 12
Scripting Object Reference
Node Methods
removeChildren Removes all the children of this node.
Syntax
node.removeChildren ( )
Arguments
N/A
Node Examples
// Create two nodes, a light and camera, and set some
// basic properties for them.
var theLight = new Light( "KeyLight" );
var theCamera = new Camera( "MainCamera" );
//Attach the nodes to the scene
scene.layer.attach( theLight );
scene.layer.attach( theCamera );
//Set some properties.
theLight.position.x = 10;
theLight.position.y = 20;
Layer
The Layer object is a special type of group that can only be attached to the Scene. The
scene is composed of a number of layers, each layer representing a collection of
elements that are grouped together for exclusive display purposes.
Each time the scene is drawn, the layers are drawn in order from back to front,
allowing for complex image composition capabilities. When a layer is created, it
contains a default camera and a default light. The settings for the default camera and
light can be changed, and new cameras and lights (and any other node type) can be
created and attached; however, there can only be one active camera for a layer at a
given time.
The layer is rendered as a full 3D scene from the viewpoint of its active camera. Layers
are independent of other layers, such that the elements on successively ordered layers
can never be obscured by elements on previous layers. This behavior allows robust
functionality such as complex overlaid menuing systems and elegantly encapsulated
media organization.
New layers can be created via scripting. The scripting object constructor creates an
empty Layer. Objects created via scripting are not available to the Anark Studio inter-
face, but they do appear in the finished project.
Scripting object constructor syntax
var theLayer = new Layer ( "sceneGraphName", "addToScene" )
Return value
Returns the new layer.
Arguments
sceneGraphName
Layer
Optional. The name of the layer in the hierarchy of the scene graph.
addToScene
Optional. This Boolean flag specifies whether this layer will be added to the scene.
Currently, true is the only valid setting.
Layers have all the properties and methods of assets, as listed in “Asset Properties” and
“Asset Methods” on page 245. They also have all the properties and methods of nodes,
as listed in “Node Properties” and “Node Methods” on page 258. In addition, layers
have the following object properties:
Layer Properties
x Adjusts the starting position of the layer along the X axis, creating a left mar-
gin for it. Specified as a percentage of the total scene width. If the X position
is adjusted, any objects located outside the bounds of the layer will be
cropped.
y Adjusts the starting position of the layer along the Y axis, creating a top mar-
gin for it. Specified as a percentage of the total scene height. Changing the Y
position of the layer maintains the aspect ratio of the objects within the
space. For example, if an object appears to take up a third of the layer before
changing the Y position, it will still appear to take up a third of the layer
afterwards.
width Sets the scale of the layer along the X axis. Specified as a percentage of the
overall width of the scene.
height Sets the scale of the layer along the Y axis. Specified as a percentage of the
overall width of the scene.
pivotX Sets the X position of the pivot point of the layer. Specified as a percentage of
the layer size.
pivotY Sets the Y position of the pivot point of the layer. Specified as a percentage of
the layer size.
transparent- Controls whether or not the layer will be transparent. When transparent-
Background Background is false, this layer will completely obscure any layers behind it
(i.e., that were drawn first). This is different from opacity, which controls
only the transparency of the objects that are attached to the layer. Defaults to
true.
color Sets the background color for the layer. The background color will only be
drawn if the layer has not been set to transparent using transparentBack-
ground.
Layer Examples
// Create a new layer.
var theLayer = new Layer( "BackgroundLayer");
//Attach the layer to the scene.
scene.attach( theLayer );
// Add an existing model to a layer.
theLayer.attach( theModel );
Chapter 12
Scripting Object Reference
Camera
The Camera object may be attached to any node, and forms the view through which a
particular layer is rendered. Each camera is associated with a specific layer, and can be
made active by setting the active property to true. When a layer is rendered as part of a
scene, the active camera that is a part of the layer is automatically used as the view-
point. Only one camera in a given layer may be active at a time.
New cameras can be created via scripting. The scripting object constructor creates an
empty Camera. Objects created via scripting are not available to the Anark Studio
interface, but they do appear in the finished project.
Scripting object constructor syntax
var theCamera = new Camera ( "sceneGraphName", attachToObject )
Return value
Returns the new camera.
Arguments
sceneGraphName
Optional. The name of the camera in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the camera will be attached. The camera must be
attached to a layer either now or later in order to appear in the scene during playback.
Cameras have all the properties and methods of assets, as listed in “Asset Properties”
and “Asset Methods” on page 245. They also have all the properties and methods of
nodes, as listed in “Node Properties” and “Node Methods” on page 258. In addition,
cameras have the following object properties:
Camera Properties
clipNear The front clip plane of the camera. Defaults to 10.
clipFar The distance from the camera beyond which nothing is drawn. Defaults to
5,000.
fov The field of view in degrees. Defaults to 90.
orthographic The Boolean flag that, when set to true, turns off perspective rendering.
fogNear The distance from the camera at which fog begins. For more information
about how fog is displayed, see “Working with fog” on page 93.
fogFar The distance from the camera at which fog makes everything opaque.
fogEnable The Boolean flag that turns on and off the fog.
fogColor The color of the fog.
lookAtPoint A vector location for the camera to look at.
lookAtLock The Boolean flag that locks the camera to the look at point.
Light
Camera Examples
// Create a new camera.
var theCamera = new Camera( "BackgroundCamera" );
//Attach the camera to an existing layer.
scene.BackgroundLayer.attach( theCamera );
// Set the camera to have white fog.
theCamera.fogColor.r = 255;
theCamera.fogColor.g = 255;
theCamera.fogColor.b = 255;
theCamera.fogEnable = true;
// Set this to be the active camera.
theCamera.active = true;
Light
The Light object is a type of node, and as such can be added as a child to any other
node such as a group or a camera. Lights are added to nodes contained within a layer,
and when they are active they illuminate the scene in a variety of ways depending on
the settings of their properties. There may be up to 8 simultaneously active lights for
each layer.
Lights are sophisticated objects and support many advanced capabilities. Because they
are nodes, they have location and rotation properties, and may be dynamically
animated to produce stunning effects.
New lights can be created via scripting. The scripting object constructor creates an
empty Light. Objects created via scripting are not available to the Anark Studio inter-
face, but they do appear in the finished project.
Scripting object constructor syntax
var theLight = new Light ( "sceneGraphName", attachToObject )
Return value
Returns the new light.
Arguments
sceneGraphName
Optional. The name of the light in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the light will be attached. The light must be attached to
a layer either now or later in order to appear in the scene during playback.
Lights have all the properties and methods of assets, as listed in “Asset Properties” and
“Asset Methods” on page 245. They also have all the properties and methods of nodes,
as listed in “Node Properties” and “Node Methods” on page 258. In addition, lights
have the following object properties:
Chapter 12
Scripting Object Reference
Light Properties
source Sets the type of light source to directional, point or spot.
0 = Directional – A Directional light casts light in parallel rays, much like sun-
light hitting the earth.
1 = Point – A Point light casts light in all directions from a single point.
Because it emits light equally in all directions, any rotation setting is
ignored for this light type.
2 = Spot – A Spot light casts a cone-shaped beam of light from a single point.
brightness The maximum level of light from this light source. This property is only
available for Point and Spot lights. Ranges from 0 to 200. Defaults to 100.
outerConeAngle Adjusts the falloff at the edge of the Spot light’s cone of light. This property is
only available for Spot lights. Ranges from 0 to 180 degrees. Defaults to 180.
linearFade Adjusts the way and speed at which the light from this light source fades to
darkness. If linearFade alone is used, then the light will diminish at a steady
rate over the distance specified by the range property. The higher the setting,
the faster the fade. expFade can be used as well to create interesting light
effects. This setting only affects Point and Spot lights. Range = 0 to 0.1.
Default = 0.
expFade Uses an exponential formula and the specified value to control the way and
the speed at which the light from this light source fades to darkness. “Real
world” light fades exponentially, but it may seem too dark for computer
graphics. The higher the setting, the faster the fade. expFade can be used
together with linearFade to create interesting light effects. This setting only
affects Point and Spot lights. Range = 0 to 0.01. Default = 0.
specular The color of highlights in the scene.
diffuse The color of the light’s direct rays.
ambient The color of indirect light in the scene.
Light Examples
// Create a light.
var theLight = new Light( "KeyLight" );
// Attach the light to an existing layer.
scene.BackgroundLayer.attach( theLight );
// Set the light's diffuse color to green and
// turn it on.
theLight.diffuse.r = 0;
theLight.diffuse.g = 255;
theLight.diffuse.b = 0;
theLight.active = true;
Group
Group
A group is the simplest type of node. A typical group acts as a simple placeholder to
which other nodes may be attached. Groups are used to organize complex data and
move sets of nodes (such as models) as though they are one.
Components are slightly more complex in that they work together with the TimeCon-
text object to provide an independent clock for an object or group of objects.
New groups can be created via scripting. The scripting object constructor creates an
empty Group object. Objects created via scripting are not available to the Anark
Studio interface, but they do appear in the finished project.
Scripting object constructor syntax
var theGroup = new Group ( "sceneGraphName", attachToObject )
Return value
Returns the new group.
Arguments
sceneGraphName
Optional. The name of the group in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the group will be attached. The group must be attached
to an object in the scene either now or later in order to appear in the scene during
playback.
Groups have all the properties and methods of assets, as listed in “Asset Properties”
and “Asset Methods” on page 245. They also have all the properties and methods of
nodes, as listed in “Node Properties” and “Node Methods” on page 258. In addition,
groups have the following object properties and methods:
Group Properties
distanceFade Enables “Soft Culling” based on the distance of objects from the camera.
When distanceFade is on, objects that are part of the group that are beyond
the fadeFar setting will not be rendered at all, while objects that are closer
than the fadeNear setting will be fully rendered. Any objects between these
ranges will be progressively more transparent. This can be used to optimize
rendering speeds of complex presentations with many objects and polygons
and can improve the appearance since aliasing of distant objects may be
reduced. Defaults to Off.
The distanceFade setting applies to all objects in the group; however, if the
group contains a subgroup that has distanceFade selected and that has differ-
ent settings for fadeNear and fadeFar, those settings will be used for the
objects within the subgroup instead. (Turning off the distanceFade setting for
the subgroup uses the settings of the parent; it does not disable distanceFade
for that subgroup.)
fadeNear Sets the distance where objects begin to fade. Objects closer than this range
are not affected by distanceFade at all. Defaults to 200.
fadeFar Sets the culling distance where objects are completely invisible. Objects in
the group that are beyond this range are not rendered. Defaults to 300.
Chapter 12
Scripting Object Reference
Group Examples
// Create a group.
this.manGroup = new Group( "BodyGroup" );
// Attach the group to an existing layer.
scene.BackgroundLayer.attach( this.manGroup );
// Attach some existing models to the group.
this.manGroup.attach( theHeadModel );
this.manGroup.attach( theTorsoModel );
this.manGroup.attach( theArmsModel );
this.manGroup.attach( theLegsModel );
// Move the entire group of objects.
this.manGroup.position.x = 100;
this.manGroup.position.y = 50;
Model
The Model object contains geometry to be rendered on the screen and is a specific
type of node. Models are the fundamental visible element within a scene. They may
be attached to other models, groups or layers, creating a hierarchy.
New models can be created via scripting. The scripting object constructor creates an
empty Model object. Objects created via scripting are not available to the Anark Studio
interface, but they do appear in the finished project.
Scripting object constructor syntax
var theModel = new Model ( "sceneGraphName", attachToObject )
Return value
Returns the new model.
Arguments
sceneGraphName
Optional. The name of the model in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the model will be attached. The model must be
attached to an object in the scene either now or later in order to appear in the scene
during playback.
Models have all the properties and methods of assets, as listed in “Asset Properties”
and “Asset Methods” on page 245. They also have all the properties and methods of
nodes, as listed in “Node Properties” and “Node Methods” on page 258. In addition,
models have the following object properties and methods:
Model Properties
materials Returns the collection of material objects attached to this model. This is read-
only.
Model
Model Properties
boxMin Returns a vector representing the minimum vertex of the bounding box for
the model. The bounding box for a model is an imaginary cube drawn
around it, and each corner of the cube is a vertex. The X, Y and Z values of
each vertex are added together and the one with the lowest value is deter-
mined to be the boxMin. The boxMin and boxMax properties are typically
used in collision detection.
boxMax Returns a vector representing the maximum vertex of the bounding box for
the model. The bounding box for a model is an imaginary cube drawn
around it, and each corner of the cube is a vertex. The X, Y and Z values of
each vertex are added together and the one with the highest value is deter-
mined to be the boxMin. The boxMin and boxMax properties are typically
used in collision detection.
Chapter 12
Scripting Object Reference
Model Methods
createPrimitive Creates a simple geometric object. This method can only be used with
“empty” models (i.e., a model created without specifying a Library asset
name). Primitives are created with dimensions of 100x100x100 units. To
alter the dimensions, use the scale property.
Syntax
model.createPrimitive ( primitiveType, subType, resolution, 0 )
Arguments
primitiveType
The type of primitive to be created.
1 = Rectangle
2 = Sphere
3 = Cone
4 = Cylinder
5 = Cube
subType
Specifies basic texture mapping for the primitive. Currently, subtypes are
supported only on rectangles.
0 = Single sided – Maps the material to the rectangle so that only one side, or
“face,” is drawn. If the rectangle is rotated so that the back face is in view,
it would appear to be completely transparent.
1 = Mirrored – Maps the material to the rectangle so that it is two-sided, with
the image flipped from left to right so that if there were text in the
image, it would be readable on both sides.
2 = Double sided – Maps the material to the rectangle so that it is two-sided
like a flag, where text would be reversed on the back side. This is the
default setting.
resolution
A number used to calculate the number of faces to be applied to the shape.
For rectangles, which are flat planes, a value of 1 is most common.
For spheres, a value of 3 is adequate and a value of 5 creates a
smooth sphere.
For cones, a value of 20 creates a smooth cone, while a value of 4
creates a pyramid.
For cylinders, a value of 10 creates a smooth surface while a value
of 6 creates a prism shape.
For cubes, a value of 1 is most common.
0
This is a placeholder for a currently undefined parameter. This must always
be set to 0.
Model
Model Methods
intersect Used for collision detection, this function determines whether or not a
model has been “hit” by a specified point.
Syntax
outDistanceSquared = model.intersect ( useCulledFaces, globalOrigin, glo-
balDirection, distance, intersection, normal )
Return value
outDistanceSquared
Either the distance squared or -1. The distance is defined by the distance
argument. If the distance squared is returned, it means the model was hit and
the exact hit distance squared is returned. If -1 is returned, it means the
model was not hit.
Arguments
useCulledFaces
A Boolean specifying whether you want the model’s culled polygons to be
checked for collision. Culling is controlled by the culling property of
materials.
globalOrigin
A positional vector in the global 3D space that will be checked for collision
with the specified model.
globalDirection
A vector specifying the ray direction from the globalOrigin.
distance
A floating point number that defines the maximum distance from the global-
Origin for an acceptable hit.
intersection
Returns the positional vector that specifies the location in global space where
the intersection with the model has occurred.
normal
Returns a directional vector that describes the direction in global space of the
normal of the model’s polygon that was intersected.
getNumVertices Returns the number of vertices in the specified model.
Syntax
numVertices = model.getNumVertices ( )
Return value
numVertices
Optional. A variable name for the returned number.
Arguments
N/A
getVertex Gets the values of an existing vertex on a model and places them into a ver-
tex object. The returned values are unmodified and untransformed; for exam-
ple, even if the model has been scaled or rotated, the vertex values that are
returned are for the “original” vertex, not the transformed data.
Syntax
model.getVertex ( inIndex, vertexObject )
Arguments
inIndex
The index location of the vertex on the model whose values you want to
access.
vertexObject
The vertex object that will hold the vertex values.
Chapter 12
Scripting Object Reference
Model Methods
setVertex Takes the values of an existing vertex and places them into the vertex at the
specified index location on a model. To optimize rendering, this method will
not be committed until the applyChanges method has been called.
Syntax
model.setVertex ( outIndex, vertexObject )
Arguments
outIndex
The index location of the vertex on the model to which you want to assign
the values.
vertexObject
The vertex object whose values will be used.
getVertexPosi- Gets the X, Y and Z coordinate information for a specified vertex on a model
tion and places it into a vector object. The returned values are unmodified and
untransformed; for example, even if the model has been scaled or rotated,
the vertex values that are returned are for the “original” vertex, not the trans-
formed data.
Syntax
model.getVertexPosition ( inIndex, vectorObject )
Arguments
inIndex
The index location of the vertex whose values you want to access.
vectorObject
The vector object that will hold the position values.
setVertexPosi- Takes a vector object containing the X, Y and Z coordinate information from
tion an existing vector object and places them into the vertex at the specified
index location on a model. To optimize rendering, this method will not be
committed until the applyChanges method has been called.
Syntax
model.setVertexPosition ( outIndex, vectorObject )
Arguments
inIndex
The index location of the vertex on the model to which you want to assign
the values.
vectorObject
The vector object whose values will be used.
applyChanges Enacts all the setVertex and setVertexPosition methods that have been speci-
fied in this behavior.
morph Takes a model and morphs all of its vertices to match those of another
model. The models must have an identical number of vertices. A floating
point number can be used to modify the amount of change to the original
model’s vertices.
Syntax
model.morph ( modelObject, amount )
Arguments
modelObject
The model to be matched.
amount
A floating point number used to control the amount of change made to the
original model’s vertices. For example, a value of .5 would mean the model
would only be changed 50%.
Text
Model Examples
// Access the first box in a group.
theBox = theGroup.models[0];
// Create a new material.
var theMaterial = new Material ( "greenSwirl" );
theMaterial.diffuse.r = 255;
Text
The Text object is a type of node that displays text. Text objects can be used to create
one-word labels, headlines, captions and entire paragraphs of scrollable text.
New text objects can be created via scripting. The scripting object constructor creates
an empty Text object. Objects created via scripting are not available to the Anark
Studio interface, but they do appear in the finished project.
Scripting object constructor syntax
var theText = new Text ( "sceneGraphName", attachToObject )
Return value
Returns the new text object.
Arguments
sceneGraphName
Optional. The name of the text object in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the text will be attached. The text object must be
attached to an object in the scene either now or later in order to appear in the scene
during playback.
Text objects have all the properties and methods of assets, as listed in “Asset Proper-
ties” and “Asset Methods” on page 245. They also have all the properties and methods
of nodes, as listed in “Node Properties” and “Node Methods” on page 258. In addi-
tion, text objects have the following object properties and methods:
Text Properties
wordWrap Enables word wrapping so that text automatically wraps to the next line
when the text hits the horizontal edge of the text box. This is only available
for paragraphs of text.
textType Specifies whether the text will be treated as line text or as a paragraph.
0 = Line – Line text grows or shrinks in length as it’s edited, but it does not
wrap to the next line. The text box will be drawn to accommodate the
text without clipping it, although any text that extends past the layer’s
borders will not be displayed.
1 = Paragraph – Paragraphs typically contain more than one line of text and
will wrap automatically from line to line if the wordWrap property has
been enabled.
Chapter 12
Scripting Object Reference
Text Properties
renderStyle Specifies how the text object is rendered.
0 = Flat – Renders the text on a plane that cannot be rotated or moved along
the Z axis. The font will remain at the specified font size, even if the text
object is scaled up or down or moved forward or backward in Z. The text
will always face the camera, even if the text object is rotated.
1 = Depth – Renders the text on a plane that can be moved forward or back-
ward on the Z axis, rotated around the Y axis, and scaled along the Z axis.
The text will always face the camera, even if the text object is rotated.
2 = Full Perspective – Renders the text on a plane that can be moved along
any axis, and can be rotated and scaled.
boxWidth Sets the width of the text box as a proportion of the current layer’s dimen-
sions. Text that extends beyond the boundaries of the text box is clipped.
Range = 0 to 1.0 Default = .25.
boxHeight Sets the height of the text box as a proportion of the current layer’s dimen-
sions. Text that extends beyond the boundaries of the text box is clipped.
Range = 0 to 1.0 Default = .25.
textColor Sets the color of the text. Defaults to white ( 255, 255, 255 ).
textString Specifies the text to be displayed.
size If the presentation is resized during playback, Flat text continues to be ren-
dered at the specified font size. However, Depth and Full Perspective text are
resized if the height of the window is changed. See the section on Presenta-
tion Size under “Editing project settings” on page 16 for information about
how assets are resized when the playback window is resized.
font Sets the font in which to display the text. Specified as a string. The specified
font can be embedded in the finished project file so that it can be displayed
on the viewer’s computer even if the font isn’t installed. By default, fonts are
not embedded because they greatly increase the file size. To enable font
embedding, you must turn on Embed Fonts in the Project Preferences. See
“Setting program and project preferences” on page 17 for more information.
If fonts are not embedded in the presentation and the viewer does not have a
font installed on his or her computer, the text will be displayed in Arial. Also,
if no font is specified for a text object, Arial will be used.
horzAlign Determines how paragraph text is positioned between the left and right bor-
ders of the text box.
0 = Left – Aligns the text along the left side of the text box.
1 = Centered – Centers the text within the text box.
2 = Right – Aligns the text along the right side of the text box.
vertAlign Determines how paragraph text is positioned between the top and bottom of
the text box.
0 = Top – Aligns the text along the top of the text box.
1 = Middle – Centers the text within the text box.
2 = Bottom – Aligns the text along the bottom of the text box.
horzScroll Moves the text to the right (by decrementing the value) or to the left (by
incrementing the value) in the text box.
vertScroll Moves the text down (by decrementing the value) or up (by incrementing
the value) in the text box.
Sound
Text Properties
useBackColor Controls whether or not the text object will be transparent. When useBack-
groundColor is true, the text object will obscure the objects behind it.
Defaults to false.
backColor Sets the background color for the text. The background color will only be
drawn if the useBackgroundColor property has been enabled.
leading Sets the spacing between lines of text.
tracking Sets the spacing between the characters in a line of text.
Sound
A sound object is a type of node that encapsulates a single sound effect. Currently,
Sound objects may be loaded from .wav, .ogg and .aiff files.
The scripting object constructor creates an empty Sound object. Objects created via
scripting are not available to the Anark Studio interface, but they do appear in the
finished project.
Scripting object constructor syntax
var theSound = new Sound ( "sceneGraphName", attachToObject )
Return value
Returns the new sound.
Arguments
sceneGraphName
Optional. The name of the sound in the hierarchy of the scene graph.
attachToObject
Optional. The object to which the sound will be attached. The sound must be
attached to an object in the scene either now or later in order to appear in the scene
during playback.
Sound objects have all the properties and methods of assets, as listed in “Asset Proper-
ties” and “Asset Methods” on page 245. They also have all the properties and methods
of nodes, as listed in “Node Properties” and “Node Methods” on page 258. In addi-
tion, sounds have the following object properties and methods:
Sound Properties
soundType Sets the type of sound to normal, polyphonic or point.
0 = Normal – A Normal sound is played at the specified volume and balance
settings.
1 = Polyphonic – A Polyphonic sound can be played multiple times simulta-
neously. This feature would most typically be used with a behavior that
calls on the sound based on user actions such as clicking on a button. For
example, if the user clicked a button several times in a row, the sound
would be played over itself each time.
volume Sets the volume of the sound. Values can be between 0 and 100. Defaults to
100, which is 100% of the loudest setting enabled on the end user’s system.
This setting is ignored for Point sounds.
Chapter 12
Scripting Object Reference
Sound Properties
loop Sets the sound to continuously loop. Defaults to true.
balance The left to right balance of the sound. Values can be between -100 and 100.
Defaults to 0. This setting is ignored for Point sounds.
duration Returns the length of the sound in seconds.
Sound Methods
play Starts playing the sound.
pause Pauses the sound.
stop Stops the sound.
seek If the sound is playing, reposition to a certain location within the sound and
continue playing. If the sound is stopped or paused, reposition to this loca-
tion but don't begin playing until set to play again. Specified in seconds.
Syntax
sound.seek ( position )
Arguments
position
The time in seconds that specifies how far into the sound to seek.
Sound Examples
// Create a new sound.
var theSound = new Sound( "Beep", BackgroundLayer );
theSound.play();
Utility
A utility is an object that either accesses data about the presentation (Mouse, Key,
Window, and Memory) or manipulates objects in the project (Vector, Vector2, Vertex,
Rotation and Color). Utilities have no shared properties or methods.
Color
The Color object encapsulates a four-component true color.
Constructor syntax
var theColor = new Color ( r, g, b, a)
Return value
Returns the new color.
Arguments
r
Optional. The red component of the color containing a value between 0 and 255.
g
Optional. The green component of the color containing a value between 0 and 255.
b
Color
Optional. The blue component of the color containing a value between 0 and 255.
a
Optional. The alpha component of the color containing a value between 0 and 255.
This property is not used in some color contexts.
Colors have the following object properties:
Color Properties
r The red component of the color containing a value between 0 and 255.
g The green component of the color containing a value between 0 and 255.
b The blue component of the color containing a value between 0 and 255.
a The alpha component of the color containing a value between 0 and 255.
This property is not used in some color contexts.
Color Methods
copy Creates an exact copy of the Color object.
Syntax
newColor = color.copy ( )
Return value
newColor
A variable name for the copy of the color.
Arguments
N/A
add Adds the given color to the current color.
Syntax
color.add ( colorObject )
Arguments
colorObject
The Color object to be added to the current color.
subtract Subtracts the RGBA components of the given color from the current color.
Syntax
color.subtract ( colorObject )
Arguments
colorObject
The color to be subtracted from the current color.
blend Blends the RGBA components of the given color into the components of the
current color by multiplying each component together.
Syntax
color.blend ( colorObject )
Arguments
colorObject
The color to blend into the current color.
Chapter 12
Scripting Object Reference
Color Methods
negative Changes the color value to be its negative. The RGBA color components are
modified by subtracting 1.0 from each component’s value to produce the
color negative.
Syntax
color.negative ( )
Arguments
N/A
scale Multiplies each the RGBA components of the color by the given factor to pro-
duce a scaled version of the original color. If the scale factor is 1.0, then the
result is the original color.
Syntax
color.scale ( scaleFactor )
Arguments
scaleFactor
The scale factor by which each color component is multiplied. If the value is
1.0, the color will not be changed.
contrast Changes the contrast of the color value. The RGB components of the color
are modified by linearly interpolating the component between 50% gray and
its current value using the following formula:
new = 0.5 + Contrast * (current - 0.5)
Where Contrast is the weighting factor of the interpolation. If Contrast is
0.0, then the color becomes 50% gray. If it is 1.0, then the new color is the
same as the original. If it is greater than 1.0, then the contrast is increased.
Syntax
color.contrast ( contrastValue )
Arguments
contrastValue
The weighting factor for altering the color’s contrast.
saturation Changes the saturation of the color value.
The RGB components of the color are modified by linearly interpolating the
component between an unsaturated value and its current value using the fol-
lowing formula:
Approximate values for each component's contribution to luminance are
based upon the NTSC standard described in ITU-R Recommendation BT.709.
gray = current.red * 0.2125 + current.green * 0.7154 + current.blue * 0.0721
new = gray + Saturation * (current - gray)
Where Saturation is the weighting factor of the interpolation. If Saturation is
0.0, then the color becomes grayscale. If it is 1.0, then the new color is the
same as the original. If it is greater than 1.0, then the color’s saturation is
increased.
Syntax
color.saturation ( saturationValue )
Arguments
saturationValue
The weighting factor for altering the color’s saturation.
Vector
Color Methods
linear Performs a linear interpolation between the current color and the specified
color, treating both as 4D vectors.
The current color acts as the source of the interpolation and Color acts as the
target. The interpolation of each component uses the following formula:
new = current + Weight * (current - Color)
Where Weight is the weighting factor for the interpolation. If Weight is 1.0,
then the color remains the current color. If it is 0.0, then the new color is the
same as Color. This is the reverse of the way the linear property of vectors
works.
Syntax
color.linear ( targetColor, weightValue )
Arguments
targetColor
The Color object that is the target color.
weightValue
The weighting factor for the interpolation.
equals Calculates and returns whether or not the current color is equal to the given
color.
Syntax
isEqual = color.equals ( compareColor )
Return value
isEqual
A variable name for the returned value.
Arguments
compareColor
The Color object to be compared to the current color.
Color Examples
// Create a color.
var theColor = new Color();
// Set the color to red.
theColor.r = 255;
Vector
A vector is a Utility object encapsulating the three floating point components X, Y
and Z.
Constructor syntax
var theVector = new Vector ( x, y, z )
Return value
Returns the new vector.
Arguments
x
Optional. The floating point value representing the X position.
y
Optional. The floating point value representing the Y position.
Chapter 12
Scripting Object Reference
z
Optional. The floating point value representing the Z position.
The Vector object has the following properties and methods:
Vector Properties
x The floating point value representing X.
y The floating point value representing Y.
z The floating point value representing Z.
Vector Methods
copy Creates an exact copy of the Vector object.
Syntax
newVector = vector.copy ( )
Return value
newVector
A variable name for the copy of the vector.
Arguments
N/A
setVector Sets the X, Y and Z values of the vector to the values of the vector supplied as
an argument.
Syntax
vector.setVector ( vectorObject )
Arguments
vectorObject
The Vector object whose values will be used.
add Adds the given vector to the current vector.
Syntax
vector.add ( vectorObject )
Arguments
vectorObject
The Vector object to be added to the current vector.
subtract Subtracts the given vector from the current vector.
Syntax
vector.subtract ( vectorObject )
Arguments
vectorObject
The vector to be subtracted from the current vector.
set Sets the X, Y and Z values of the vector to the given values.
Syntax
vector.set ( X, Y, Z )
Arguments
X
Required. The floating point value representing the X position.
Y
Required. The floating point value representing the Y position.
Z
Required. The floating point value representing the Z position.
Vector
Vector Methods
dot Calculates and returns the dot product of the current vector and the vector
supplied as an argument.
Syntax
product = vector.dot ( vectorObject )
Return value
product
A variable name for the returned product.
Arguments
vectorObject
The vector that is used to calculate the dot product.
scale Multiplies each component of the current vector by the given factor.
Syntax
vector.scale ( scaleFactor )
Arguments
scaleFactor
The scale factor applied to each component of the vector.
cross Modifies the current vector to be the cross product of the current vector and
the vector supplied as an argument.
Syntax
vector.cross ( vectorObject )
Arguments
vectorObject
The vector that is used to calculate the cross product.
equals Calculates and returns whether or not the current vector is equal to the given
vector.
Syntax
isEqual = vector.equals ( compareVector )
Return value
isEqual
A variable name for the returned value.
Arguments
compareVector
The Vector object to be compared to the current vector.
length Calculates and returns the length (magnitude) of the current vector.
Syntax
vectorLength = vector.length ( )
Return value
vectorLength
A variable name for the magnitude of the vector.
Arguments
N/A
lengthSquared Calculates and returns the squared length (squared magnitude) of the current
vector.
Syntax
squaredVectorLength = vector.length ( )
Return value
squaredVectorLength
A variable name for the squared magnitude of the vector.
Arguments
N/A
Chapter 12
Scripting Object Reference
Vector Methods
normalize Normalizes the current vector, making it a unit vector.
The normalized vector is defined to be:
NormVector = vector / Magnitude(V)
Syntax
vector.normalize ( )
Arguments
N/A
distance Calculates and returns the distance between the current vector and the given
vector.
Syntax
vectorDistance = vector.distance ( compareVector )
Return value
vectorDistance
A variable name for the distance between the vectors.
Arguments
compareVector
The Vector object to be compared to the current vector.
distanceSquared Calculates and returns the squared distance between the current vector and
the given vector.
Syntax
squaredVectorDistance = vector.distanceSquared ( compareVector )
Return value
squaredVectorLength
A variable name for the squared distance between the vectors.
Arguments
compareVector
The Vector object to be compared to the current vector.
maxVector Modifies the current vector to contain elements that are the maximum
between the given vector and the current vector.
Syntax
vector.maxVector ( compareVector )
Arguments
compareVector
The Vector object whose elements are tested against the current vector to
build the maximum.
minVector Modifies the current vector to contain elements that are the minimum
between the given vector and the current vector.
Syntax
vector.minVector ( compareVector )
Arguments
compareVector
The Vector object whose elements are tested against the current vector to
build the minimum.
Vector2
Vector Methods
linear Modifies the current vector by performing a linear interpolation between the
current vector and the given vector.
The interpolation is created using the following formula:
NewVector = OrigVector + InterpParam( Vector2 - OrigVector )
Syntax
vector.linear ( compareVector, interpParam )
Arguments
compareVector
The Vector object that acts as the second vector for the interpolation.
interpParam
A floating point number used for the interpolation.
transform Transforms the current vector by the given transform matrix.
The current vector is made into a 4D vector by setting w = 1.0, and this new
vector is transformed by the given matrix; the result is then projected back
into w = 1.0.
Syntax
vector.transform ( matrixObject )
Arguments
matrixObject
The transformation matrix.
Vector Examples
// Create a vector.
var theNewPosition = new Vector ( 25, 10, 5 );
// Set the position of a model.
theModel.position.setVector ( theNewPosition );
theModel.position.x += 10;
Vector2
A vector2 is a Utility object encapsulating two floating point components X and Y. In
Anark Media, a vector2 provides texture coordinates for images. Texture coordinates
are often called UV coordinates.
Constructor syntax
vector2 = new Vector2 ( x, y )
Return value
Returns the new two-dimensional vector.
Arguments
x
Optional. The floating point value representing the X position.
y
Optional. The floating point value representing the Y position.
Chapter 12
Scripting Object Reference
Vector2 Methods
copy Creates an exact copy of the vector2 object.
Syntax
newVector2 = vector2.copy ( )
Return value
newVector2
A variable name for the copy of the two-dimensional vector.
Arguments
N/A
set Sets the X and Y values of the two-dimensional vector to the given values.
Syntax
vector2.set ( X, Y )
Arguments
X
Required. The floating point value representing the X position.
Y
Required. The floating point value representing the Y position.
setVector Sets the X and Y values of the vector2 to the values of the vector2 supplied as
an argument.
Syntax
vector2.setVector ( vector2Object )
Arguments
vectorObject
The Vector object whose values will be used.
Vertex
Models are composed of a mesh of polygons, which are defined by their vertices. A
vertex includes the following elements:
A set of position coordinates (X, Y and Z).
A normal, which is a vector that points outward at a 90 degree angle from the vertex.
The vertex normal is calculated by averaging the plane normals of all polygons adja-
cent to the vertex.
A set of texture coordinates, which determine how images can be mapped to a
model’s polygons. Texture coordinates are often called UV coordinates, but in Anark
Media, a vector2 containing X and Y coordinates is used.
When a new vertex is created, it is always empty. You must use the get and set
methods for a model object to add data to and extract data from a vertex object.
Constructor syntax
var theVertex = new Vertex ( )
Rotation
Return value
The variable name of the vertex.
The Vertex object has the following properties:
Vertex Properties
position The vector that specifies the position of the vertex in 3D space.
normal The vector that specifies the direction the vertex is facing.
texture The vector2 that specifies the X and Y coordinates of the vertex to be used for
texture mapping.
Vertex Examples
// Create a vertex.
var vertex50 = new Vertex ( );
// Access a particular vertex on a model.
theModel.getVertex ( 50, vertex50);
// Increment the X position of the vertex.
var vertex50.position.x += 5;
theModel.setVertex (50, vertex50);
theModel.applyChanges ( );
Rotation
A rotation is a special kind of vector encapsulating the data and operations of three
angular components, X, Y and Z.
Constructor syntax
var theRotation = new Rotation ( x, y, z )
Return value
Returns the new rotation.
Arguments
x
Optional. The floating point value representing the degrees of rotation about the X
axis.
y
Optional. The floating point value representing the degrees of rotation about the Y
axis.
z
Optional. The floating point value representing the degrees of rotation about the Z
axis.
Chapter 12
Scripting Object Reference
Rotation Methods
lookAt Modifies the rotation object so that it “looks at” the specified vector.
Syntax
rotation.lookAt ( vector )
Arguments
vector
The vector the rotation object will look at.
Example
function onUpdate( )
{
var distance = Scene.Layer.Sphere.position.copy( );
distance.subtract( parent.position );
parent.rotation.lookAt( distance );
}
copy Creates an exact copy of the rotation Vector object.
Syntax
newRotation = rotation.copy ( )
Return value
newRotation
A variable name for the copy of the rotation vector.
Arguments
N/A
scale Multiplies each component of the current rotation vector by the given factor.
Syntax
rotation.scale ( scaleFactor )
Arguments
scaleFactor
The scale factor applied to each component of the rotation vector.
subtract Subtracts the given rotation vector from the current rotation vector.
Syntax
rotation.subtract ( compareRotation )
Arguments
compareRotation
The rotation vector to be subtracted from the current rotation vector.
add Adds the given rotation vector to the current rotation vector.
Syntax
rotation.add ( compareRotation )
Arguments
compareRotation
The rotation vector to be added to the current rotation vector.
Rotation
Rotation Methods
maxVector Modifies the current rotation vector to contain elements that are the maxi-
mum between the given rotation vector and the current rotation vector.
Syntax
rotation.maxVector ( compareRotation )
Arguments
compareRotation
The rotation vector whose elements are tested against the current rotation
vector to build the maximum.
minVector Modifies the current rotation vector to contain elements that are the mini-
mum between the given rotation vector and the current rotation vector.
Syntax
rotation.minVector ( compareRotation )
Arguments
compareRotation
The rotation vector whose elements are tested against the current rotation
vector to build the minimum.
equals Calculates and returns whether or not the current rotation vector is equal to
the given rotation vector.
Syntax
isEqual = rotation.equals ( compareRotation )
Return value
isEqual
A variable name for the returned value.
Arguments
compareRotation
The rotation vector to be compared to the current rotation vector.
linear Modifies the current rotation vector by performing a linear interpolation
between the current rotation vector and the given rotation vector.
The interpolation is created using the following formula:
NewRotation = OrigRotation + InterpParam( Rotation2 - OrigRotation )
Syntax
rotation.linear ( compareRotation, interpParam )
Arguments
compareRotation
The rotation vector that acts as the second rotation vector for the interpola-
tion.
interpParam
A floating point number used for the interpolation.
transform Transforms the current rotation vector by the given transform matrix.
The current rotation vector is made into a 4D vector by setting w = 1.0, and
this new vector is transformed by the given matrix; the result is then pro-
jected back into w = 1.0.
Syntax
rotation.transform ( matrixObject )
Arguments
matrixObject
The transformation matrix.
Chapter 12
Scripting Object Reference
Matrix
A matrix is an advanced mathematical structure used to describe the local space of an
object and to transform objects within the space. In Anark Studio, matrices are 4 x 4
arrays. The Matrix constructor creates an identity matrix. An identity matrix is a
square matrix with its diagonal elements equal to 1 and its off-diagonal elements
equal to 0. It performs for matrix arithmetic what the number 1 performs for the arith-
metic of numbers.
Constructor syntax
var theMatrix = new Matrix ( )
Return value
Returns the new matrix.
The Matrix object has the following properties and methods:
Matrix Properties
_11 The floating point value representing the first element on the X axis.
_12 The floating point value representing the second element on the X axis.
_13 The floating point value representing the third element on the X axis.
_14 The floating point value representing the X of the “world” coordinate
system.
_21 The floating point value representing the first element on the Y axis.
_22 The floating point value representing the second element on the Y axis.
_23 The floating point value representing the third element on the Y axis.
_24 The floating point value representing the Y of the “world” coordinate system.
_31 The floating point value representing the first element on the Z axis.
_32 The floating point value representing the second element on the Z axis.
_33 The floating point value representing the third element on the Z axis.
_34 The floating point value representing the Z of the “world” coordinate system.
_41 The floating point value representing the translation factor for the X axis.
_42 The floating point value representing the translation factor for the Y axis.
_43 The floating point value representing the translation factor for the Z axis.
_44 The floating point value representing the translation factor for “world” coor-
dinate system.
Matrix Methods
isIdentity Returns a Boolean flag that indicates whether or not the matrix is an identity
matrix.
Matrix
Matrix Methods
copy Creates an exact copy of the Matrix object.
Syntax
newMatrix = matrix.copy ( )
Return value
newMatrix
A variable name for the copy of the matrix.
Arguments
N/A
set Sets the values of the matrix to the values of the matrix supplied as an
argument.
Syntax
matrix.set ( matrixObject )
Arguments
matrixObject
The Matrix object whose values will be used.
scale Modifies the current matrix by right-multiplying into it the scaling matrix
represented by the given X, Y and Z components.
Syntax
matrix.scale ( x, y, z )
Arguments
x
The floating point value representing the X component of the scaling.
y
The floating point value representing the Y component of the scaling.
z
The floating point value representing the Z component of the scaling.
translate Modifies the current matrix by right-multiplying into it the translation
matrix represented by the given X, Y and Z components.
Syntax
matrix.translate ( x, y, z )
Arguments
x
The floating point value representing the X component of the translation.
y
The floating point value representing the Y component of the translation.
z
The floating point value representing the Z component of the translation.
rotate Modifies the current matrix by right-multiplying into it the rotation matrix
specified by the given angles in degrees.
Syntax
matrix.rotate ( x, y, z )
Arguments
x
The X angle of rotation given in degrees.
y
The Y angle of rotation given in degrees.
z
The Z angle of rotation given in degrees.
Chapter 12
Scripting Object Reference
Matrix Methods
multiply Multiplies the current matrix by the given matrix. The given matrix is right-
multiplied into the current matrix.
Syntax
matrix.multiply ( matrixObject )
Arguments
matrixObject
The matrix to be multiplied with the current matrix.
transpose Modifies the current matrix to be its own transpose. The transpose of a
matrix has its elements flipped along its horizontal line (upper left to lower
right).
Syntax
matrix.transpose ( )
Arguments
N/A
invert Modifies the current matrix to be its own inverse. The inverse of matrix A is
defined to be the matrix B if and only if AB = BA = I, where I is the Identity
Matrix.
Only those matrices whose determinates are non-zero will have an inverse.
Therefore, not all matrices may be inverted.
Syntax
matrix.invert ( )
Arguments
N/A
identity Resets the current matrix to an identity matrix.
Syntax
matrix.identity( )
Arguments
N/A
Mouse
Mouse
The Mouse object is available at any time to obtain the coordinates of the mouse
within the presentation window, and to access the cursor and the state of the mouse
buttons. Because it is a global object, it can be accessed directly.
The Mouse object has the following properties:
Mouse Properties
x The X location of the mouse in pixels, relative to the left side of the presenta-
tion window.
y The Y location of the mouse in pixels, relative to the top of the presentation
window.
cursor Sets and returns the type of icon to be used as the mouse cursor. This prop-
erty can be set to any of the following values:
0 = Default – Uses the operating system’s current cursor (usually the arrow).
1 = None
2 = Arrow ( )
3 = Crosshair ( )
4 = Finger ( )
5 = Hand ( )
6 = Help ( )
7 = I-Beam ( )
8 = No ( )
9 = Resize all directions ( )
10 = Resize Northeast/Southwest ( )
11 = Resize North/South ( )
12 = Resize Northwest/Southeast ( )
13 = Resize West/East ( )
14 = Wait ( )
cursorOverride Sets a mouse cursor and overrides any other cursor setting made by any other
behavior. This property can be set to any of the values the cursor property
can be set to.
Chapter 12
Scripting Object Reference
Mouse Examples
function onMouseOver ()
{
Mouse.cursor = 4;
}
function onMouseOut ()
{
// Reset the cursor to the system default.
Mouse.cursor = 0;
}
function onDetach ()
{
// Just in case onMouseOut didn't get called,
// reset the cursor.
Mouse.cursor = 0
}
Key
The Key object is available at any time to obtain information about what keys, if any,
are being pressed. Because it is a global object, it can be accessed directly.
The Key object has the following properties:
Key Properties
code Returns the key code for the specified keyName. The code property is useful
for accessing the key code without having to specify it, as you would for the
keyCode property of an Event object. The keyName must be specified in
order to access the keyCode. For a complete list of all the key names that are
available to behavior scripts in Anark Studio, as well as their keyboard labels,
see “Appendix C: Key Names” on page 315.
Syntax
key.keyName.code
pressed Returns a Boolean indicating whether a key is pressed.
Example
if ( Key.a.pressed && Key.shift.pressed )
{
//Move object where mouse is - 400
this.parent.position.x = Mouse.x - 400;
//Move object where Mouse is - 300
this.parent.position.y = -( Mouse.y - 300 );
}
Window
Key Examples
\\Pass the code for the Up Arrow key to an Event object.
function onKeyDown (inEvent)
{
if ( inEvent.keyCode == Key.up.code)
\\Make the parent object rotate 10.
this.parent.rotation.x += 10;
}
Window
The Window object is available at any time to obtain the current length and height of
the presentation. Because it is a global object, it can be accessed directly.
The Window object has the following properties:
Window Properties
yHeight The height of the presentation in pixels.
xWidth The width of the presentation in pixels.
Window Examples
// Get the width and height of the presentation.
winWidth = Window.xWidth;
winHeight = Window.yHeight;
Memory
The Memory object is available at any time to provide feedback and control over
memory usage by the scripting engine. Because it is a global object, it can be accessed
directly.
The Memory object has the following properties and methods:
Memory Properties
usage The amount of memory in bytes currently being used.
total The total amount of memory in bytes that could be used by the scripting
engine.
available The amount of memory in bytes currently available for the script engine to
use.
Memory Methods
collectGarbage Deletes scripting objects that no longer have references to them that are
accessible via the scripting engine. While garbage collection is usually per-
formed whenever more memory is needed, this method provides a way to do
it manually.
Chapter 12
Scripting Object Reference
Memory Methods
deleteUnuse- Deletes any dynamically created Library resources that are not currently
dResources being used. Dynamically created resources include those that have been cre-
ated using scripting or by dynamically loading a Playback Module.
sizeOf Returns the memory in bytes used by the specified script asset and all of its
children. For images and models, the heavy buffer data is not considered part
of the asset, so it is not included in the returned memory usage figure.
Syntax
memory.sizeOf ( scriptObject, objectOnly )
Arguments
scriptObject
The script asset to be evaluated for memory usage.
objectOnly
Optional. A Boolean that when set to false specifies that the method only
returns the memory used by the object itself. Defaults to true.
Memory Examples
memoryUse = memory.sizeOf( scene.layers[0] );
AKEvent
AKEvent
The AKEvent object is the base class for event objects. The latestEvent property of the
presentation object is an AKEvent object. The latestEvent property can be used in an
event handler function in a behavior script or in an action that executes a script (such
as Execute Scriptlet) to access and modify the event’s properties. For more information
about actions, see “Understanding actions” on page 120. For a listing of all the avail-
able event handler functions, see “Event handler functions” on page 224.
The primary use for creating a new AKEvent object is so that you can then fire that
event in a behavior using the fireEvent method of Assets.
Constructor syntax
var theEvent = new AKEvent ( "eventName" )
Arguments
eventName
The name of the event.
Return value
Returns the new event.
The AKEvent object has the following object properties:
AKEvent Properties
name Sets and returns the name of this event.
object A reference to the object to which the event happened. For onMouseWheel
events, this always refers to the scene object.
deltaTime Available for the onUpdate event handler only. It accesses the amount of
time in seconds since the scene was last refreshed.
percentDone Available for the onLoadProgress event handler only. It accesses the propor-
tion of a section of a presentation that has completed loading. Range = 0 - 1.
loadSource Available for loading events only. Returns the URL or file name of the file
being loaded.
positionX Available for mouse events (except onMouseWheel) only. The X-axis posi-
tion of the mouse when the event was triggered.
positionY Available for mouse events (except onMouseWheel) only. The Y-axis position
of the mouse when the event was triggered.
mouseScroll Available for the onMouseWheel event only. The distance that the wheel
button has rotated, expressed in multiples of 120. A positive value indicates
that the wheel button has rotated away from the user. A negative value indi-
cates that the wheel button has rotated toward the user.
keyCode Available for key events only. The ID of the key that triggered the event.
keyChar Available for key events only. The alphanumeric character that triggered the
event.
shift Available for key events only. Returns a Boolean indicating whether the Shift
key was being pressed when the event was triggered.
Chapter 12
Scripting Object Reference
AKEvent Properties
ctrl Available for key events only. Returns a Boolean indicating whether the Con-
trol key was being pressed when the event was triggered.
caps Available for key events only. Returns a Boolean indicating whether the Caps
Lock key was being pressed when the event was triggered.
bubble Specifies whether or not the event will bubble up the object model hierarchy.
0 = Bubbling enabled. This is the default setting.
1 = Bubbling disabled.
For more information about event bubbling, see “Working with mouse
events and event bubbling” on page 230.
AKEvent Examples
function onKeyDown ( )
{
if ( presentation.latestEvent.keyCode == key.up.code )
\\Make the parent object rotate 1 unit.
parent.rotation.x += 1;
}
Scriptlet Example
\\rotate an object 50 units
function onUpdate ()
{
rotation.x += presentation.latestEvent.deltaTime * 50;
}
Miscellaneous
There are several miscellaneous object types: Presentation, TimeContext, Player,
Container, XMLNode and XML. The Presentation object is the current presentation.
The TimeContext object is a helper object for components. The Player and Container
objects access information about the environment that is playing the presentation.
The XMLNode and XML objects allow you to exchange data between an XML
document and an Anark Media presentation. These objects do not belong to any of
the other general types and they don’t share any of the other types’ properties or
methods.
Presentation
Presentation
The Presentation object is simply the current presentation. The Presentation object
has no constructor because it is always available via the global presentation
property.
Because the Presentation object is not an asset, node or utility, it does not share the
properties or methods of those object types. It has only the following object properties
and methods:
Presentation Properties
realTime Returns the current time in the presentation.
latestEvent Provides access to the AKEvent object for the last event that was fired.
Presentation Methods
isBuffered Returns a Boolean indicating whether the specified Library resource is fully
buffered yet. If the resource has been buffered, then it also triggers an onBuf-
fered event. If the resource is not yet buffered, then it connects to the
remoteSource for the file and begins buffering it.
Syntax
value = presentation.isBuffered ( "libraryResource" )
Return value
value
Optional. A variable name for the returned Boolean.
Arguments
libraryResource
The variable name of the music or video file to be checked or buffered.
fireEvent Executes the specified event. The fireEvent method, together with the
AKEvent object, allows you to create and execute custom events in scripting.
Syntax
presentation.fireEvent ( eventObject )
Arguments
eventObject
The AKEvent object that was being listened to.
Presentation Examples
function onAttach ( )
{
this.lastUpdate = presentation.realTime;
}
function onUpdate ( )
{
theCurrentTime = presentation.realTime;
var Delta = theCurrentTime - this.lastUpdate;
}
Chapter 12
Scripting Object Reference
TimeContext
The TimeContext object provides the time context for the objects in the scene or
inside a component. Components are parent containers for one or more objects that
are assigned an independent timeline in the scene.
A project has a clock that controls the timing of actions for the objects in the scene.
This clock provides the objects with a time context. Each time a new frame is gener-
ated, the objects in the scene ask their time context “what time is it?” and then deter-
mine what state they need to be in based in part on that information. Anark Studio
also provides independent timelines that allow you to create a separate time context
for a particular group of objects. The time context can be repeated either by looping
back to the beginning or by “ping-ponging” between moving forward or backward.
Components simplify the process of creating repetitive animations and interactive
behaviors such as buttons and menu systems. Components can even be nested inside
other components.
Components can only be created using the Anark Studio interface. The TimeContext
object has no constructor because it is always available as the context property of any
asset.
Because TimeContext objects are neither assets, nodes nor utilities, they do not share
the properties or methods of those object types. They have only the following object
properties and methods:
TimeContext Properties
minTime Sets the starting time for the time context. Defaults to 0.
maxTime Sets the total amount of time for the time context.
jumpTime Sets the total length of the time context for the group. This value is used for
looping and for ping-ponging. When you convert a regular group to a com-
ponent, the jumpTime is automatically set to the duration of the group. If
the value is shortened, the repetition interval of the time context will be set
to the new value. If the value is the same or longer than the duration of the
component, then the time context will not be repeated. Specified in seconds.
jumpTo Sets a point within the time context from which to begin looping. This is par-
ticularly useful for jumping past an introductory section after the first time
through so that it will be skipped during subsequent repetitions. If a jumpTo
value has been set, it shortens the time context accordingly during looping
or ping-ponging. Specified in seconds.
contextTime Sets and returns the current time in the time context in seconds.
contextType Controls how the scene or component will be played back.
0 = Stop at End – Plays through from beginning to end once.
1 = Loop – Plays through from beginning to end continuously.
2 = Ping Pong – Plays forward and then in reverse for the duration of the
component or scene.
3 = Ping – Plays forward and back only once.
4 = Play through – Plays through from beginning to end once and then
jumps to the next slide (i.e., time context) in the Slide list.
Defaults to Stop at End.
Player
TimeContext Properties
paused Returns a Boolean indicating whether or not the current time context is
paused.
rate Sets the speed at which the time context is executed. This affects the speed of
the animation for all the objects that rely on this time context, including any
animation created by a behavior that uses the contextTime property. A set-
ting of 2 means animated objects will appear to move twice as fast as normal;
a setting of .5 means they will appear to move half as fast as normal, etc. A
negative value (e.g., -.3, -2, etc.) makes the time context run backwards. This
setting does not affect the frame rate of the presentation or how often the
scene is updated.
currentSlide Returns the name of the current slide.
TimeContext Methods
play Sets the time context to play again after it has been paused.
pause Pauses a currently playing time context.
activateSlide Jumps playback to the specified slide.
Syntax
timeContext.activateSlide ( slideName )
Arguments
slideName
The name of the slide to activate. Only the slides associated with the parent
time context can be activated. Slides associated with a nested component are
not available.
nextSlide Jumps playback to the next slide in the Slide list.
previousSlide Jumps playback to the previous slide in the Slide list.
precedingSlide Jumps playback to the last viewed slide.
TimeContext Examples
function onMouseDblClick ( )
{
this.context.activateSlide( "Slide2" );
}
Player
The Player object exposes information about the environment that is executing the
presentation. Currently, information about the Container object is exposed. As a root-
level object, it has no constructor.
Because the player is not an asset, node or utility, it does not share the properties or
methods of those object types. It has only the following object properties:
Player Properties
version The version number of the player. This helps identify what methods and
properties are available for scripts as new functionality is added.
Chapter 12
Scripting Object Reference
Player Properties
containerName Returns the name of the application that is executing the presentation.
ActiveX = The ActiveX® control which displays presentations in Internet
Explorer.
AnarkMediaPlayer = Anark Player.
containerVer- The version number of the Container, which is the application that is execut-
sion ing the presentation.
container Returns the Container object.
platform Returns the computer platform the player is on.
Win32 = Microsoft Windows
platformVer- Returns the version of the platform the player is on. For Windows, it will
sion return one of the following:
4.0 = Windows 95
4.10 = Windows 98
4.90 = Windows ME
5.0 = Windows 2000
5.1 = Windows XP
Additional information is returned for Windows versions, including the ser-
vice pack version, but because so many combinations are possible, they are
not covered here. The format of the full return value is:
5.1.2600.2
frameRate Returns the current number of frames per second for the last frame that was
rendered.
avgFrameRate Returns the average frame rate of presentation playback. The average frame
rate is calculated using the following formula:
avgFrameRate = avgFrameRate + (frameRate - avgFrameRate) / 20
frameTime Returns the amount of time, in milliseconds, since the previous frame.
avgFrameTime Returns the average amount of time, in milliseconds, between each frame. It
is calculated using the following formula:
avgFrameTime = avgFrameTime + (frameTime - AvgFramesPerMS ) / 20
totalFrames Returns the current total number of frames rendered during playback.
Container
The Container object exposes information about the application that is executing the
presentation. The Container object has no constructor because it is always available as
the container property of the Player object. Currently two containers are available:
ActiveX and AnarkMediaPlayer.
Because the Container object is neither an asset, node nor utility, it does not share the
properties or methods of those object types. It has only the following object methods:
Container
Container Methods
launch Available only for the AnarkMediaPlayer container, this method will launch
a properly specified application and, optionally, a file.
Syntax
player.container.launch ( "command line", flags )
Arguments
command line
The application and file to launch. If the application and file are in the same
directory as the AMPlayer.exe file, then this can be specified using just the
executable name and file name as in:
player.container.launch( "Acrobat.exe Data.pdf", 0 )
Windows uses the following search path for launch:
1. The directory from which the application is loaded.
2. The current directory for the parent process.
3. The Windows System directory.
4. The Windows directory.
5. The directories specified in the PATH environment variable.
The absolute or relative path to the executable and file can be specified for
the PATH environment variable as in the following example:
player.container.launch( ".\\Reports\\Acrobat.exe
.\\Reports\\Data.pdf", 0 )
You must escape the backslashes in order for the path to be read properly (or,
you can use forward slashes instead).
In Windows, you can also call on Explorer to launch an application. Use the
relative path from the AMPlayer.exe to the file you want to launch as in the
following example:
player.container.launch( "explorer ./Reports/Data.pdf",
0 )
OS uses the absolute path to the file and uses the default application to open
it, as in the following example:
player.container.launch( "users/username/sites/index.html",
0 )
flags
Currently no flags are supported, so this must always be set to 0.
exit Available only for the AnarkMediaPlayer container, exit causes the Anark
Player application to exit.
Container Examples
// Make sure the Player is available
if ( player != null)
{
// Make sure the command is available on the container
if ( player.containerName == "AnarkPlayer" )
{
player.container.launch( "Acrobat.exe Data.pdf", 0 )
}
}
Chapter 12
Scripting Object Reference
XMLNode
The XMLNode object provides a way to quickly add nodes and attributes to an XML
object or to other XML nodes, allowing you to build and control XML document
trees.
Constructor syntax
var XMLNode = new XMLNode ( )
Return value
Returns the new XMLNode object.
Because the XMLNode object is not an asset, node or utility, it does not share the
properties or methods of those object types. It has only the following object properties
and methods:
XMLNode Properties
hasNodes Returns a Boolean indicating whether or not the object has nodes.
nodeCount Returns the number of child nodes of this XMLNode. Sub-nodes (i.e., chil-
dren of children) are not included in the count.
attributeCount Returns the number of attributes.
parent Returns the parent node.
attributes Returns an array of the names of the attributes contained within this
XMLNode.
nodes Returns an array of the child nodes of this XMLNode. Sub-nodes (i.e., chil-
dren of children) are not included in the count.
name Sets and returns the name of this node.
text Sets and returns the text that will show up between the begin and end tags
for this node.
XMLNode Methods
addNode Adds an existing XMLNode object as a child of this XMLNode.
Syntax
XMLNode.addNode ( inNode )
Arguments
inNode
The XMLNode object to be added as a child of this XMLNode.
removeNode Removes the specified XMLNode object from this XMLNode. Any child
nodes of the removed node are also deleted.
Syntax
XMLNode.removeNode ( inNode )
Arguments
inNode
The XMLNode object to be removed from this XMLNode.
XMLNode
XMLNode Methods
getNode Returns the specified node.
Syntax
node = XMLNode.getNode ( node )
Return value
nodeData
Optional. A variable name for the returned node object.
Arguments
node
A string or integer that specifies the node you want to get.
copyNode Copies this node and all of its children.
Syntax
node = XMLNode.copyNode ( )
Return value
node
Optional. A variable name for the copy.
getAttribute Returns the specified attribute’s data.
Syntax
attributeValue = XMLNode.getAttribute ( inAttribute )
Return value
attributeValue
Optional. A variable name for the attribute’s value.
Arguments
inAttribute
The attribute. The attribute can be specified by name or by index.
setAttribute Overwrites the specified attribute’s data with the given value.
Syntax
XMLNode.setAttribute ( inAttribute, inValue )
Arguments
inAttribute
The attribute to be overwritten. The attribute can be specified by name or by
index.
inValue
The new value specified as a string.
addAttribute Adds the specified attribute name and value to this XMLNode object.
Syntax
XMLNode.addAttribute ( name, value )
Arguments
name
The name for the new attribute.
value
The new value specified as a string.
removeAt- Removes the specified attribute from this XMLNode.
tribute Syntax
XMLNode.removeAttribute ( inAttribute )
Arguments
inAttribute
The attribute to be removed, specified by either name or index.
Chapter 12
Scripting Object Reference
XMLNode Methods
toString Converts the data contained within the XMLNode, including child nodes
and attributes, to an XML string.
Syntax
string = XMLNode.toString ( )
Return value
string
Optional. A variable name for the string.
XML
The XML object is a type of XMLNode. It loads, parses and posts XML data and
catches errors. It can be used to load XML data for use in a presentation and to collect
and send data to an XML document.
Note: Loading or posting XML requires a valid license key. Please contact your
Anark sales representative for licensing information.
Constructor syntax
var XML = new XML ( inString )
Return value
Returns the new XML object.
Arguments
inString
Optional. A string of valid XML.
Unlike other object types, the XML object has some special events associated with it.
These events provide information about the loading process for XML data. The XML
object is not an asset, node or utility, and it does not share the properties or methods
of those object types. It has all the properties and methods of XMLNodes, as listed in
“XMLNode Properties” and “XMLNode Methods” on page 298. It also has the
following object properties, methods and function callbacks:
XML Properties
async Specifies whether asynchronous loading will be used. Defaults to false. If set
to true, then the presentation will continue running while the XML is load-
ing. In order to use asynchronous loading, you would also need to set up
event callbacks to check on the loading process. To do this, you would use
the XML function callbacks. See “XML Function Callbacks” on page 301 for
more information.
error Returns a Boolean indicating whether there was an error during loading or
parsing or posting.
errorString Returns an error string indicating what error occurred during loading or
parsing or posting.
XML
XML Methods
load Loads the specified XML document.
Syntax
XML.load ( inURL )
Arguments
inURL
The URL of the XML document to load. If HTTPS is used, port 443 is used by
default. To specify a different port, the URL must be followed by a colon and
a port number (e.g., https://www.anark.com:444). If you use backslashes
when specifying the URL, they must be escaped. See “Specifying paths in
scripting” on page 212 for more information.
Please note, loading XML requires a valid license key. Please contact your
Anark sales representative for licensing information.
post Posts the XML object to the specified URL.
Syntax
XML.post ( inURL )
Arguments
inURL
The URL of the XML document to save. Only HTTP or HTTPS protocols can
be used. If HTTPS is used, port 443 is used by default. To specify a different
port, the URL must be followed by a colon and a port number (e.g., https:/
/www.anark.com:444). If you use backslashes when specifying the URL,
they must be escaped. See “Specifying paths in scripting” on page 212 for
more information.
Please note, posting XML requires a valid license key. Please contact your
Anark sales representative for licensing information.
parse Passes the specified buffer (in the form of a string) to the XML object and
parses it.
Syntax
XML.parse ( inString )
Arguments
inString
The string of valid XML to be parsed.
Chapter 12
Scripting Object Reference
XML Examples
function GetWeather( inAirportCode )
{
var theDataString = "[No Data]"
if ( theXML.error == false )
{
theDataString = theXML.getNode( "station" ).getNode( "name" ).text;
theDataString += "\\n";
return theDataString;
}
function onAttach()
{
//parent is a text object
parent.textString = GetWeather( "DEN" );
}
303
Anark_Studio_User_Guide.book Page 304 Monday, March 19, 2007 10:34 AM
Anark_Studio_User_Guide.book Page 305 Monday, March 19, 2007 10:34 AM
Appendix A
Supported Media Formats
Windows.
307
Anark_Studio_User_Guide.book Page 308 Monday, March 19, 2007 10:34 AM
Appendix B
Shortcut Keys
File Menu
Command Keyboard Shortcut
New Ctrl + N
Open Ctrl + O
Save Ctrl + S
Import Resource Ctrl + R
Preview in browser or Anark Player F12
Shift + Enter
Export Ctrl + Shift + S
Edit Menu
Command Keyboard Shortcut
Undo Ctrl + Z
Redo Ctrl + Y
Ctrl + Shift + Z
Cut Ctrl + X
Copy Ctrl + C
Paste Ctrl + V
Duplicate object Ctrl + D
Edit Project Settings Ctrl + P
View Menu
Command Keyboard Shortcut
View Assistant palette F1
View Actions Ctrl + Shift + A
View Basic Objects Ctrl + Shift + B
View Inspector Ctrl + Shift + I
View Library Ctrl + Shift + L
View Slides Ctrl + Shift + D
View Storage Ctrl + Shift + R
View Timeline Ctrl + Shift + T
Bounding boxes on/off Ctrl + B
Pivot points on/off Ctrl + Alt + P
Rulers on/off Ctrl + Alt + R
Script Menu
Command Keyboard Shortcut
Find (behavior text) Ctrl + F
Find Next (behavior text) F3
Replace (behavior text) Ctrl + H
Compile (edited behavior) F7
Show or hide line numbers F8
Timeline Menu
Command Keyboard Shortcut
Set keyframe(s) F6
Enable/Disable Autoset keyframes K
Help Menu
Command Keyboard Shortcut
Open the Assistant palette F1
Selection Keys
Command Keyboard Shortcut
Group select A
Item select V
Select the Library resource for an instance Ctrl + L
Select an instance of a Library resource Ctrl + I
Appendix B
Shortcut Keys
Playback Keys
Command Keyboard Shortcut
Play presentation Enter/Return
Space bar (hold down)
Stop playback Enter/Return (during playback)
Space bar (release)
When any Transform tool is enabled, change to the currently enabled tool.
you can temporarily enable a different The following table lists how the keys
tool by holding down modifier keys. The affect the currently selected tool:
tool icon in the Project window will
Currently Selected Transform Tool
Modifier Key Rotate Position Scale
Alt Scale Scale Rotate
Ctrl Position Rotate Position
Appendix B
Shortcut Keys
Snapping Keys
Command Keyboard Shortcut
Snap Playhead to next tick mark , (backward)
. (forward)
Snap Playhead to every 5th tick mark Shift + < (backward)
Shift + > (forward)
Snap item in the Timeline to other items Shift + drag
while dragging with the mouse
Appendix B
Shortcut Keys
315
Anark_Studio_User_Guide.book Page 316 Monday, March 19, 2007 10:34 AM
Appendix C
Key Names
Appendix C
Key Names
Arguments
Arguments are placeholders for values that you want to
apply to a function or object constructor. Arguments are
enclosed in parentheses and are separated by commas. In
the following example, 400, 300 and 0 specify the X-, Y- and
Z-axis positions, respectively, for the new Vector object,
this.mousePos.
this.mousePos = new Vector( 400, 300, 0 );
For a complete list of all the arguments that each object type
takes, see “Scripting Object Reference” on page 243.
Array
An array is an object that stores data by assigning a
numbered position, rather than a named value, to the
object. It is essentially an indexed list of variables. The
numbered positions of the index always begin with 0.
Square brackets are used to access the numbered values of an
array.
Arrays are particularly useful for storing numerous pieces of
data using a single variable and for iterating through a list in
a for loop.
var sphereColor = new Array ();
sphereColor[0] = "green";
sphereColor[1] = "blue";
sphereColor[2] = "yellow";
sphereColor[3] = "red";
Additionally, arrays have a dynamic length property that is
automatically updated when new values are added to an
array. In the example above, the length property of the
319
Anark_Studio_User_Guide.book Page 320 Monday, March 19, 2007 10:34 AM
Glossary
Scripting Glossary
sphereColor array is automatically set to Scripted behaviors are the only way to
4 because there are four entries, but if create interactive elements in a project.
you added two more values to the array, They can also be used to add procedural
it would update the length property to 6. animation (i.e., animation based on
You can optionally preset the length mathematical formulas) to your project.
property for the array by passing it as an Animation created in the Anark Studio
argument to the array constructor: interface uses static keyframes that
control a single parameter for a single
var sphereColor = new Array (4); moment in time. Procedural animation
This creates an array with four empty allows you to create dynamic keyframes
index entries, but again, the length that can change based on runtime
property will be incremented if more information.
than four entries are set for it later on.
Child
Note, however, that the length property
In the Anark Studio object model hier-
only goes up. It won’t be reduced if only
archy, a child is an object that is
two entries are set for it. In that case, it
attached directly to a parent object,
will have two empty entries in addition
which influences some of its properties.
to the ones that have been set. Short of
Child objects can have children attached
deleting the array or assigning it the
to them.
value null, the number of elements in an
array cannot be reduced, so be conserva- Clipping plane
tive when assigning a length to an array. A clipping plane is a plane that is vertical
You can call on the length property of to the line of sight beyond which objects
the array to control the behavior of all disappear. The near clipping plane
the members of the array. The following defines the point at which objects
line of code evaluates the length prop- moving towards camera will disappear.
erty of the sphereColor array and assigns The far clipping plane defines the point
the number 4 to the variable numColors: at which objects moving away from the
var numColors = sphereColor.length; camera will disappear.
Asset Conditional
An asset is any of the predefined objects, Conditional statements allow your
including Music, Material, Animation- scripts to make decisions about what
Track, Image, Node and Scene, that are code to execute based on current condi-
the fundamental building blocks of tions. Conditionals (if, if…else, ?:
Anark Media. Assets serve as resources and switch) contain one or more
for scripting content. expressions that evaluate to either true
or false. The decision about what code to
Behavior execute next is based on the outcome.
Behavior scripts are chunks of code (in function onAttach()
the form of a script) that tell the objects {
they are attached to what to do and var playedBefore = false;
when to do it. Some common interactive if ( (currentTime >= 5) &&
behaviors include buttons, linking, ( playedBefore == false ) )
menus, toolbars, key commands, etc. {
this.LoopMusic.play(); Function
playedBefore = true; A function is a procedure that is defined
} once and can be executed multiple times
} by a program. Functions act on and
This if statement evaluates whether the return data. A function definition looks
current time (currentTime) is greater like this:
than or equal to 5 seconds. It then
checks to see if playedBefore is false. If function onMouseDown(inEvent)
{
both conditions match, it plays the
this.parent.rotation.x += .05;
music and sets playedBefore to true, }
which then invalidates the if A function is invoked and is passed
statement. information by enclosing it in paren-
For more information about condi- theses ( ). A function stored as the prop-
tionals, see “Using conditional state- erty of an object is called a method.
ments” on page 234. For more information about using and
creating functions, see “Creating func-
Culling
tions” on page 221.
Culling is the process of eliminating the
polygons that face away from the viewer Group
and therefore can’t be seen. Culling A group is an object that acts as a simple
speeds up the rendering of the scene, placeholder for other objects. Groups are
since all those unseen polygons use up used to organize complex data and move
valuable processing power. sets of nodes such as models as though
they are one.
Event Handler
Event handlers are predefined functions Components, which are created from
that provide cues for the action and groups, are slightly more complex in
interactivity of a scene. They include that they work together with the Time-
mouse events such as onMouseDblClick Context object to provide an indepen-
and onMouseDown, keypress events dent clock for an object or group of
such as onKeyDown, and system-wide objects.
functions such as onUpdate and
onAttach. Image
An Image object is the equivalent of an
For more information about event image or material map in 3D modeling
handlers, see “Event handler functions” programs. Image maps are used to create
on page 224. the look of a texture on objects (e.g.,
stone, clouds, checkered, etc.) or to map
Expression
a 2D graphic such as a still photo or even
An expression is a piece of the script that
a video clip to the object’s surface.
can be evaluated by the script interpreter
to generate a value. The value can be of Layer
any valid data type (number, string, A layer is an object that allows you to
Boolean, etc.). An expression can group the elements of the scene in a
perform a calculation, manipulate char- special way. Layers in Anark Studio are
acters, call a function or test a value. similar to the layers used in many 2D
Glossary
Scripting Glossary
graphic design programs. In 2D graphics, work much like behaviors. They can be
layers are rendered like stacked sheets of attached to objects, but other objects
acetate. The content of each layer cannot be attached to them. The data
remains distinct from the content of contained in Music objects is streamed
other layers, but the final image is a rather than embedded in the final
composite of all the layers. presentation like Sound objects are.
3D layers in Anark Studio are used in a
Node
similar way, but instead of being
A node is a particular type of asset that is
rendered like sheets of acetate, they are
physically present in a scene and can
rendered like a stack of glass blocks. Each
therefore be manipulated visually. A
block contains a 3D scene with elements
node can contain other nodes. Nodes
that interact with each other, but not
include models, cameras, lights, groups,
with the elements of the other layers.
sounds and layers.
Objects in one layer never penetrate into
another layer no matter how far you Object
move them backward or forward. An object is a compound data type that
contains any number of properties and
Material
methods. Dot syntax (.) is used to access
A material is an object that specifies the
a named property or method of an
surface appearance of a model. A mate-
object.
rial controls the color, shininess and
opacity of a model, among other things. Object Model
Material blending modes are used to The object model is a kind of hierar-
specify how the material will be mixed chical mapping of parent-child relation-
with the other elements of the scene. ships used in both the Anark Studio
Images can be attached to materials to interface and behavior scripts to address
create patterns or to map a 2D graphic to and operate parent and child objects in a
the object’s surface. scene. These parent-child relationships
allow you to set up animation parame-
Method
ters and interactive behaviors for groups
A method is a function that is a property
of objects with a single setting and to
of an object. Methods control the
animate objects in relation to other
behavior of objects.
objects. This object model is used to
Model represent the scene at a given point in
A model is a 3D mesh object. Models can time. For more information about the
be created in other applications such as object model hierarchy, see the “Object
3ds max, or simple primitives can be model overview” on page 214.
created using the buttons on the Basic
Operator
Objects tab.
Operators are terms and symbols that are
Music used to calculate a new value from one
A Music object is a type of asset that or more values. Examples include the
contains a song or music clip. In the addition operator (+), the division oper-
object model hierarchy, Music objects ator (/) and the equality operator (==).
Glossary
Scripting Glossary
Index Index
325
Anark_Studio_User_Guide.book Page 326 Monday, March 19, 2007 10:34 AM
Index
Index 327
Anark_Studio_User_Guide.book Page 328 Monday, March 19, 2007 10:34 AM
Index
Index 329
Anark_Studio_User_Guide.book Page 330 Monday, March 19, 2007 10:34 AM
Index
Index 331
Anark_Studio_User_Guide.book Page 332 Monday, March 19, 2007 10:34 AM
Index
Index 333
Anark_Studio_User_Guide.book Page 334 Monday, March 19, 2007 10:34 AM
Index
M keyframes 156
.m1v file extension 305 objects in the Project window 98
Make Opacity Image 112 palettes 11
mapping Playhead 151
image to a model 104 projects 10
video to a model 113 slides 134
maps. See images, materials tabs on palettes 11
margins of layers 84 timebars 148
Master Animation toggle 146 See also Position property
master keyframe .mp2 and .mp3 files 255
characteristics of 152 .mp2 file extension 305
use caution when deleting 155 .mp3 file extension 305
master slides 134 .mpe file extension 305
Material Editor, guidelines to follow 38 .mpeg file extension 305
Material object 249 Multiply blending mode 102
definition of 322 in scripting 250
materials music
guidelines for creating and exporting 38 adjusting the volume 115
properties of 100 cueing to start 116
in scripting 249 prebuffering 168
troubleshooting 43 properties of 115
Matrix object 284 in scripting 255
Maya, guidelines to follow 37, 39 streaming 165
media events 124 Music object 255
media formats, supported 55 compared to Sound object 322
melting assets 234, 246
Memory object 289
N
Name
menu shortcuts 307
for custom events 79, 291
method (definition) 322
for custom functions 78
mipmapping 109
for custom properties 77
in scripting (as mipmapMode) 252
naming objects
Mirrored tiling for images 106
in Anark Studio 63
Model object 264
in scripting 215
models
navFlags HTML parameter 210
guidelines for creating 37
navigate
guidelines for exporting
action 128
to 3DS 41
global function 210
to AMX 40
Negative Map for images 106
obscured models, working with 100
nested components 137
properties of 97
new keyword 214
in scripting 264
new project, creating 10
troubleshooting 43
Next Slide action 130
updating the Library resource 55
in scripting 295
modulus 214
Node objects
mouse events 124, 230
definition of 322
Mouse object 287
description of all 257
mouseScroll, event property 291
nonidentity, testing for 214
.mov file extension 305
Normal blending mode 102
moving
in scripting 250
application window 11
Index 335
Anark_Studio_User_Guide.book Page 336 Monday, March 19, 2007 10:34 AM
Index
Index 337
Anark_Studio_User_Guide.book Page 338 Monday, March 19, 2007 10:34 AM
Index
Index 339
Anark_Studio_User_Guide.book Page 340 Monday, March 19, 2007 10:34 AM
Index
Index 341
Anark_Studio_User_Guide.book Page 342 Monday, March 19, 2007 10:34 AM
Index
Index 343
Anark_Studio_User_Guide.book Page 344 Monday, March 19, 2007 10:34 AM
Index
Index 345
Anark_Studio_User_Guide.book Page 346 Monday, March 19, 2007 10:34 AM
Index