DirectAnimation Animated Header --How to Create a JScript Animation DirectAnimation Animated Header --How to Create a JScript Animation* Microsoft DirectAnimation SDK
*Contents  *Index  *Topic Contents
*Previous Topic: Guide to Samples
*Next Topic: How to Create a VBScript Animation

How to Create a JScript 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.

The following steps show how to construct a simple DirectAnimation control in JScript.

  1. In your HTML file, declare your DAViewerControl object. The object's name can be anything. Here, it is called DAControl. The CLSID must be as shown:
    <DIV ID=controlDiv>
    <OBJECT ID="DAControl"
        STYLE="position:absolute; left:10; top:10;width:500;height:450"
        CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D">
    </OBJECT>
    </DIV>
    
  2. Define your script language.
    <SCRIPT LANGUAGE="JScript">
    <!--
    
  3. Extract either the PixelLibrary or MeterLibrary from your control.
       m = DAControl.PixelLibrary;
    

    — or —

       m = DAControl.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 them.

  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 Image property is set to a solid blue plane that covers the screen:
       DAControl.Image = m.SolidColorImage(m.Blue);
    
  5. Render the image or sound with the DAViewerControl subroutine Start():
       DAControl.Start();
    
  6. Close the JScript scripting section:
    //-->
    </SCRIPT>
    

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

*Top of Page