Cameras in DirectAnimation are objects of the DACamera (or Java CameraBvr) class type. They can be constructed with the DAStatics.PerspectiveCamera (or Java Statics.perspectiveCamera)or the DAStatics.ParallelCamera (or Java Statics.parallelCamera) methods, and are operated on by methods such as DACamera.transform (or Java CameraBvr.transform).
To render 3-D geometries as 2-D images, use the DAGeometry.render (or Java GeometryBvr.render) method, which works on a geometry and returns an image.
The following Java 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 DAImage.ClipPolygon function (or Java ImageBvr.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 | Gray |
| 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.