This section assumes you are familiar with Microsoft® DirectAnimation® controls, Microsoft ActiveX® controls, and scripting.
Transforms are displayed on Web pages inside DirectAnimation control objects. They enable you to define the transform, set its properties, and specify how it should develop over time. It also enables transforms to interact with other DirectAnimation behaviors and objects to create time-varying graphics output.
To use a transform with DirectAnimation in a Web page, you typically follow these steps.
To see the most basic use of a transform in DirectAnimation, you can view the source HTML of the Wipe transform sample. The following section shows how this sample file follows each of the preceding steps to use a transform in a Web page.
<OBJECT ID="DAControl_Wipe" STYLE="width:200;height:200" CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D"> </OBJECT>
Notice that the dimensions of the image area are specified as STYLE attributes of the OBJECT tag.
<SCRIPT LANGUAGE="JScript"> m = DAControl_Wipe.MeterLibrary; </SCRIPT>
For the previous example, all script commands for the transform are located after the line that creates the MeterLibrary.
theTransform = new ActiveXObject("DXImageTransform.Microsoft.Wipe");
inputs = new Array(2); inputs[0] = m.ImportImage("../art/image/tigerstripe.jpg"); inputs[1] = m.ImportImage("../art/image/metablob.jpg");
Some transforms require a certain number of inputs, but others accept one or many inputs. For input information for a specific transform, see the Transform Reference.
In the following code, the forward variable is a DANumber that changes from 0 to 1 in 3 seconds, and back is a similar variable that changes from 1 to 0 in 3 seconds. Both use the DirectAnimation Interpolate function to create these behaviors. The Progress variable is created as a sequenced behavior of the forward and back behaviors, repeated forever.
forward = m.Interpolate(0, 1, 3); back = m.Interpolate(1, 0, 3); progress = m.Sequence(forward, back).RepeatForever();
theTransform.GradientSize = 0.5; theTransform.WipeStyle = 1;
The Transform Reference lists two custom properties for the Wipe transform: GradientSize and WipeStyle. The default value for GradientSize is 0.25, but the previous code changes that value to 0.5. Changing the WipeStyle property to a value of 1 causes the transition region to sweep up and down, instead of left and right.
theResult = m.ApplyDXTransform( theTransform, inputs, progress );
The ApplyDXTransform function accepts three input parameters: a transform object, an array of input images, and a DANumber for the Progress property. The value returned by the function contains the transform output.
If the transform is not an animation (such as BasicImage or Emboss), you can specify null for the Progress behavior.
DAControl_Wipe.Image = theResult.OutputBvr; DAControl_Wipe.Start();
Note To view this transform you must have Microsoft® DirectX® Media 6, Microsoft Internet Explorer 5, Microsoft Windows® 98 Second Edition, or Windows 2000 installed.
This is just one way that you can use transforms in DirectAnimation. For more examples, see the Transform Demos section.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.