    Contents  Index  Topic Contents
    Previous Topic: How to Create a JScript Animation
    Next Topic: How to Build a DirectAnimation Java Applet or Application

> ## How to Create a VBScript Animation

> The DirectAnimation library works with the DirectAnimation integrated-media control (DAViewerControl). Library calls are made through a scripting language, such as JScript or VBScript, to construct an animation and play it from an HTML file.

> To construct a simple DirectAnimation control in VBScript:

> 1. In your HTML file, declare your DAViewerControl object. The object's name can be anything. Here, it is called DAMyCtl. The CLSID must be as shown:

>        <OBJECT ID="DAMyCtl"
>           STYLE="position:absolute; left:30%; top:100;width:300;height:300"
>           CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D">
>        </OBJECT>

> 2. Define your script language.

>        <SCRIPT LANGUAGE="VBScript">
>        <!--

> 3. Extract either the PixelLibrary or MeterLibrary from your control.

>           Set m = DAMyCtl.PixelLibrary

>    — or —

>           Set m = DAMyCtl.MeterLibrary

> 4. Write your code. When you have created the image or sound you want to display (which can be as elaborate as you like), set it to the DAViewerControl's Image property or Sound property. In this case, the DAViewerControl Image property is set to a solid blue plane that covers the screen:

>           DAMyCtl.Image = m.SolidColorImage(m.Blue)

> 5. Render the image or sound with the DAViewerControl subroutine Start:

>           DAMyCtl.Start

> 6. Close the VBScript scripting section:

>        -->
>        </SCRIPT>

> © 1998 Microsoft Corporation. All rights reserved. Terms of Use.

> Top of Page