<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="/lib/xsl/devedge-1.00/article_en.xsl"?>
<nde:article 
  url="/toolbox/examples/2002/xb/xbAnimatedElement/" 
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:nde="http://devedge.netscape.com/2002/de"
  xmlns:ent="http://devedge.netscape.com/2003/ent"
  xml:lang="en"
  >

 <nde:header>

   <nde:title>
      Class xbAnimatedElement
   </nde:title>

   <nde:category>
     Manpage
   </nde:category>

  <nde:pubdate year="2002" month="04" day="21" />
  <nde:moddate year="2002" month="07" day="22" />

  <nde:summary>
      Cross Browser DHTML Animated Element
  </nde:summary>

  <nde:authlist>
    <nde:author>
      <nde:authname>Bob Clary</nde:authname>
      <nde:authaffil>Netscape Communications</nde:authaffil>
    </nde:author>
  </nde:authlist>

  <nde:channels>
    <nde:channel id="examples"/>
    <nde:channel id="xb-2002"/>
  </nde:channels>

</nde:header>


 <nde:head>
 </nde:head>

 <nde:content>
   <h2>Synopis</h2>
   <pre><![CDATA[class xbAnimatedElement
{
  xbAnimatedElement(String id, Function pathFunc);

  // properties
  String      id; 
  String      name; 
  HTMLElement div;  
  Number      runId;
  Function    pathFunc;
  Number      tick;
  
  // methods
  void        start();
  void        stop();
}]]></pre>

    <h2>Source</h2>
    <p>
      <a href="xbAnimatedElement.js">xbAnimatedElement.js</a>
    </p>

    <h2>Uses</h2>
    <ul>
      <li>nothing</li>
    </ul>

    <h2>See Also</h2>
    
    <ul>
     <li>
       <a href="/toolbox/examples/2002/xb/xbMarquee/">xbMarquee</a>
     </li>
     <li>
       <a href="/toolbox/examples/2002/xb/xbPositionableElement/">xbPositionableElement</a>
     </li>
     <li>
       <a href="/toolbox/examples/2001/stock-ticker/">Stock Ticker</a>
      </li>
    </ul>

    <h2>Description</h2>
      <h3>Notes</h3>

        <h4>Script Location/Invocation</h4>
        <p>
          xbAnimatedElement requires that the HTML Content to be positioned be 
          contained inside of an absolutely positioned HTML Element that has
          a unique ID attribute.
        </p>

        <h4>Cross Browser Support</h4>
        <p>
          Fully supports Gecko based browsers such as Netscape 6.x, Netscape 7.x, CompuServe 7.0
          on all platforms. Supports Internet Explorer 5.5+ on Windows. Supports Opera 5+ on Windows
          and Netscape Navigator 4.x. 
        </p>

        <h2>Properties</h2>
    <dl>

        <dt>
          id
        </dt>
        <dd>
          <p>readonly String - ID Attribute to be given to the
            DIV containing the elements to be positioned.
      </p>
        </dd>

        <dt>
          name
        </dt>
        <dd>
          <p>readonly String - Name of the global variable created
            during construction which holds a reference to the newly created 
            xbAnimatedElement object. This is used internally in during the animation using
            the setTimeout function.
          </p>
        </dd>

        <dt>
          runId
        </dt>
        <dd>
          <p>readonly Number - Timer ID for the animation. Returned
            by setTimeout.
          </p>
        </dd>

        <dt>
          pathFunc
        </dt>
        <dd>
          <p>Function - 
            path function which take an integer argument (the tick or time)
            and returns an object with properties x
            and y which are to be used to position
            the element.
          </p>
        </dd>

        <dt>
          div
        </dt>
        <dd>
          <p>readonly HTMLElement - reference to the Element which
            contains the HTML that will be positoned. Note that the ID attribute of the element
            will be the ID attribute used in the xbAnimatedElement constructor. This ID
            can be used to style the contents using CSS.
          </p>
        </dd>

        <dt>
          styleObj
        </dt>
        <dd>
          <p>readonly Object - reference to the div's stylable 
      object.
          </p>
          <p>
            For DOM HTML and DOM CSS Compatible browsers such as Mozilla, 
            Internet Explorer and Opera this is a reference to div's
      CSS style object.
          </p>
          <p>
            For Navigator 4, this is a reference to the div itself.
          </p>
        </dd>

        <dt>
          refreshInterval
        </dt>
        <dd>
          <p>readonly Number - the number in miliseconds
      to wait before refreshing the position of the div.
          </p>
        </dd>
    
        <dt>
          tick
        </dt>
        <dd>
          <p>readonly Number - 
            a counter which is incremented each time the
            element is moved.
          </p>
        </dd>
    
    </dl>

    <h2>Methods</h2>
    <dl>

        <dt>xbAnimatedElement(String id, Function pathFunc)</dt>
        <dd>
          <p>Constructs an instance of the xbAnimatedElement class.</p>
          <p>
            <h3>Arguments:</h3>
          </p>
          <p>
            String id - ID of the div.
          </p>
          <p>Function pathFunc - 
            Reference to Function which returns the new position of the element.
          </p>
          <p>
            <h3>Returns:</h3>
            <p>nothing</p>
          </p>
          <p>
            <h3>Support</h3>
            <p>
              Gecko/Netscape 6+, Internet Explorer 4+, Opera and Navigator 4.
            </p>
          </p>
        </dd>

        <dt>start()</dt>
        <dd>
          <p>
            <h3>Returns:</h3>
            <p>
              Nothing
            </p>
          </p>

          <p>
            This method starts the positioning of the div. This method should be called
            in a page's onload event handler.
          </p>
        </dd>

        <dt>stop()</dt>
        <dd>
          <p>Stops the updating of the div's position</p>
          <p>
            <h3>Arguments:</h3>
            <p>
              None
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>
              Nothing
            </p>
          </p>
        </dd>

    </dl>

    <h2>Examples</h2>

    <p>
      Please view source for each example in order to understand it's 
      construction.
    </p>

      <h3>Download</h3>
      <p>
        <a href="examples/xbAnimatedElement-examples.zip">xbAnimatedElement-examples.zip</a>
      </p>

    <h3>General Examples</h3>

    <h4>
      <a href="examples/circle.html">
      Move an image around a circle.
      </a>
    </h4>
    <p>
      <h5>Support</h5>
      <p>
      Netscape 4.x, Netscape 6.x/7.x, Netscape Gecko Based clients like Compuserve 7, Internet Explorer 5/Windows, 
      Opera 5+
      </p>
    </p>

    <h4>
      <a href="examples/walk.html">
        Perform a Random Walk
      </a>
    </h4>
    <p>
      <h5>Support</h5>
      <p>
      Netscape 4.x, Netscape 6.x/7.x, Netscape Gecko Based clients like Compuserve 7, Internet Explorer 5/Windows, 
      Opera 5+
      </p>
    </p>
  

 </nde:content>

<nde:related area="nde">
  <nde:item url="/toolbox/examples/2002/xb/">More xbAPI Examples</nde:item>
</nde:related>

</nde:article>
