<HTML>
<HEAD>
<TITLE>DirectAnimation JScript SDK 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>
<CENTER>
<font face="Verdana" color=blue size=+3><B>Animated properties in JScript</B></font>
</CENTER>
<font face="Arial" size="+3">
<DIV ID="DropWave1" STYLE="position:absolute; width:300; top:100; filter:shadow(direction=315,enabled=1)">
This is a div using an animated string
</DIV>

<DIV ID="DropWave2" STYLE="position:absolute; width:300; top:200; filter:shadow(direction=315,enabled=1)">
This is a div using an animated number
</DIV>

<DIV ID="DropWave3" STYLE="position:absolute; width:300; top:300; filter:shadow(direction=315,enabled=1)">
This is a div using function callbacks
</DIV>
</font>

<DIV STYLE="position:absolute; left:400; top:100; width:300;">
<font face="Verdana" color=blue size=+1>
Behaviors don't just have to be used for multimedia elements, they can also be used to create a value 
which constantly updates a dynamic HTML property.  Time varying strings, numbers, and function callbacks 
are demonstrated here.</font>
</DIV>

<OBJECT ID="DAControl"
  STYLE="position:absolute; width:1; height:1" 
  CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D">
</OBJECT>

<SCRIPT LANGUAGE="JScript">
<!--
  // The DirectAnimation library
  m = DAControl.MeterLibrary;  

  filterStr = m.ConcatString(m.DAString("shadow(direction="), getNumber().ToString(0));
  filterStr = m.ConcatString(filterStr, m.DAString(")"));

  // Using a DAString we can build strings which have time varying elements
  filterStr = filterStr.AnimateProperty("DropWave1.style.filter", "JScript", false, .1);
  DAControl.AddBehaviorToRun(filterStr);

  // Using a DANumber we can build a property which changes over time
  filterVal = getNumber().AnimateProperty("DropWave2.filters[0].direction", "JScript", false, .1);
  DAControl.AddBehaviorToRun(filterVal);

  // The AnimateProperty method also allows us to call an arbitrary function instead
  filterMethod = getNumber().AnimateProperty("setFilter", "JScript", true, .1);
  DAControl.AddBehaviorToRun(filterMethod);

  DAControl.Start();

  function setFilter(val) { // callback for third animateProperty method
    DropWave3.filters[0].direction = val;
  }

  function getNumber() {  // Makes some randomized time varying number
   return m.Sequence(m.DANumber(0).Duration(2*Math.random()), m.Interpolate(0,360,1)).RepeatForever();  
  }
//-->
</SCRIPT>
</BODY>
</HTML>
