<HTML> 
<HEAD>
<TITLE>DirectAnimation SDK, VBScript sample</TITLE>
<SCRIPT LANGUAGE="JScript">
<!--
if (window.top.frames.length!=0 && window.top.frames[0].ShowNoButtons!=null)
    window.top.frames[0].ShowNoButtons();
//-->
</SCRIPT>
</HEAD>	 

<BODY BGCOLOR=WHITE TOPMARGIN=15 LEFTMARGIN=20>
<FONT FACE="Verm.na, Arial, Helvetica" SIZE=2> 
<CENTER>
<H1>A Spline Shape and Path</H1>
</CENTER>

<OBJECT ID="DAControl"
   STYLE="position:absolute; left:100; top:75;width:400;height:450" 
   CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D">
</OBJECT>

<SCRIPT LANGUAGE="VBScript">
<!--
sub window_onLoad
  Set m = DAControl.PixelLibrary

  '* control points of 2D cubic BSpline
  splinePts = Array(0,-100, -75,-200, -125,-175, -175,-125, _
                    -125,25, -25,50, 0,125, 0,125, 0,125, _
                    25,50, 125,25, 175,-125, 75,-200, 0,-100)
  '* Uniform knot vector with interpolation of first and last points
  splineKnts = Array(0,0,0,1,2,3,4,5,6,7,8,9,10,11,11,11)
  
  '* construct the spline path
  Set splineCurve = m.CubicBSplinePath(splinePts, splineKnts)
  
  '* fill the region enclosed by the spline
  Set pink = m.ColorRGB(1,0,1)
  Set fillImg = m.SolidColorImage(pink)      
  Set splineImg = splineCurve.Fill(m.DefaultLineStyle, fillImg)
  
  '* construct a transform that traverses the spline in 7 secs
  '* and repeats that action continuously
  Set pathTf = m.FollowPath(splineCurve, 3).RepeatForever()
   
  '* construct a red dot that travels along the spline
  Set fillImg = m.SolidColorImage(m.Green)
  Set dotImg = m.Oval(10,10).Fill(m.DefaultLineStyle, fillImg)
  Set mDotImg = dotImg.Transform(pathTf)
  
  '* the resulting image is the travelling red dot overlaying the
  '* green spline-bounded region (and converted to centimeters).
  Set finalImg = m.Overlay(mDotImg, splineImg)

  '* set the image as the model to be displayed  
  DAControl.Image = finalImg
  '* set the background in case of a non-windowless browser (such as IE3)
  DAControl.BackgroundImage = m.SolidColorImage(m.Blue)

  '* start the animation
  DAControl.Start
end sub

-->
</SCRIPT>
</FONT>
</BODY>
</HTML>
