Cameras in DirectAnimation are objects of the CameraBvr (or DACamera) class type. They can be constructed with the Statics.perspectiveCamera (or DAStatics.PerspectiveCamera) and Statics.parallelCamera (or DAStatics.ParallelCamera methods, and are operated on by methods such as CameraBvr.transform (or DACamera.transform).
To render 3-D geometries as 2-D images, use the GeometryBvr.render (or DAGeometry.render) method which works on a geometry and returns an image.
The following code fragment constructs a scene from the union of lights and an imported cube, and then renders that scene into a 2-D image with a perspective camera.
URL geomBase = buildURL(getImportBase(),"file:/c:/DxM/Media/geometry/"); GeometryBvr cube = importGeometry(buildURL(geomBase,"cube.x")); GeometryBvr lights = ambientLight; GeometryBvr scene = union(lights, cube); CameraBvr camera = perspectiveCamera(1, 0); ImageBvr renderedGeometry = scene.render(camera);
The perspectiveCamera method's n and p parameters define, respectively, the position of the near clip plane and of the projection point on the positive z-axis.
The resulting image is the portion of the original image that falls in the matte region and is otherwise transparent and undetectable.
A shortcut to clipping an image with a polygonal region is the ImageBvr.clipPolygon (or DAImage.ClipPolygon) method, which generates a polygonal matte and does a clip.
thisColor = m.ColorHsl(0.5, 0.5, 0.5); col = m.ColorRgb(1, 0, 0); //red
DirectAnimation defines the following color constants:
Java Reference | Scripting Reference |
aqua | Aqua |
black | Black |
blue | Blue |
cyan | Cyan |
fuchsia | Fuchsia |
gray | Color |
green | Green |
lime | Lime |
magenta | Magenta |
maroon | Maroon |
navy | Navy |
olive | Olive |
purple | Purple |
red | Red |
silver | Silver |
teal | Teal |
white | White |
yellow | Yellow |
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.