Index Topic Contents | |||
Previous Topic: Scripting Reference - DirectAnimation Classes Next Topic: DAArray Class |
Scripting Reference Introduction
The Scripting Reference is organized by classes. For example, there is a section on the DAImage class. Each class contains a description of its functions, including syntax, returned values, and how to use the function. At the end of each class, there is a list of functions that, while relevant to that particular class, are included in the DAStatics library. This library is very large, and it may be easier to familiarize yourself with its contents by looking at specific classes and seeing what DAStatics functions are pertinent. When parameters are described as animated numbers, this means they must be of type DANumber, not that they must necessarily change over time.
This introduction contains the following topics:
Differences between VBScript and JScript
Syntax and terminology are based on VBScript conventions. However, there are only a few simple differences between that and JScript. Those differences that pertain directly to Microsoft® DirectAnimation are:
- This reference is organized according to Visual Basic conventions, which uses functions, which return values, and subroutines, which do not, and properties. JScript distinguishes between methods, which are always associated with objects, functions, which are not, and properties, which are analagous to Visual Basic properties.
- The syntax differs only in that JScript ends with a semicolon while VBScript does not.
- The syntax for creating a new object is different. The following example shows how to create new objects both in VBScript and JScript:
// This is VBScript Set myPt = CreateObject("DirectAnimation.DAPoint2") // This is JScript myPt = new ActiveXObject("DirectAnimation.DAPoint2");The PixelLibrary and the MeterLibrary
The MeterLibrary and the PixelLibrary set the unit of measurement to meters or pixels respectively. Both return the DAStatics object, so, to gain access to that library, one of these libraries must be chosen. There are two important differences between the libraries (other than the obvious one of different units of measurement). They are:
- The MeterLibrary considers positive-y to be up and the origin to be in the center of the view. The PixelLibrary considers positive-y to be down.
- If the PixelLibrary is chosen, pixels are the unit of measurement only when something is being constructed. Returned values are always in meters. For example, if you construct a DAPoint2 object in pixels and then ask for its x-coordinate, the value will be returned in meters.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.