How to Create a VBScript Animation

The Microsoft® DirectAnimation® library works with the DirectAnimation integrated-media control (DAViewerControl). Library calls are made through a scripting language, such as Microsoft® JScript® or Microsoft® Visual Basic® Scripting Edition (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
    

    The variable m is shorthand for the DAStatics Library. Every function and property that is in that library needs to be preceded by this variable so the interpreter knows where to find it.

  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>
    

Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.