Animates a specified attribute of an object.
When animating style properties on an object, the property, and any related properties, must be initialized in the object's style. For example, when animating the top or left properties, you must initialize the top and left properties, as well as the position.
The following example demonstrates how to use the t:ANIMATE element to move a div.
<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>t:ANIMATE Demo</TITLE>
<?IMPORT namespace="t" implementation="#default#time2">
</HEAD>
<BODY>
<DIV ID="oDIV" STYLE="position:absolute; top:100px; left:50px; width:100px;
height:50px; border:solid black 1px; text-align:center;">Moving DIV!</DIV>
<t:ANIMATE targetElement="oDIV" attributeName="left" to="200" dur="5"
fill="hold"/>
</BODY>
</HTML>
The prefix t: is used to associate this element with an Extensible Markup Language (XML) namespace. You must declare the XML namespace in the html tag of your document when using this element.
<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
You must then import the tag definitions from the time2 behavior by using the IMPORT processing instruction.
<?IMPORT namespace="t" implementation="#default#time2">
When writing script to dynamically change the properties of an active animation, developers should consider a couple of issues. Because results might be unpredictable or undefined when you change the properties of an active animation, restart the animation with beginElement after you have made the change. For example:
<SCRIPT>
object.endElement();
object.path="M 0 0 L 100 100";
object.beginElement();
</SCRIPT>
For the animate, animateMotion, and animateColor objects, the time2 behavior uses the following model to evaluate which properties to animate.
- The values property, if specified, overrides any setting for the from, to, or by properties.
- The from property is used unless the values or path properties are specified.
- The to property, if specified, overrides any setting for the by property.
- The by property doesn't override any properties.
To change an active animation from a path to a values list through script:
<SCRIPT>
object.endElement();
object.path=null;
object.values="100,100;0,0";
object.beginElement();
</SCRIPT>
The members listed in the following table might not be accessible through scripting until the window.onload event fires. Waiting for this event to fire ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and that all the behavior's properties, methods, and events are available for scripting. Using any of the behavior-defined members before the window.onload event fires could result in a scripting error, indicating that the object does not support that particular member.
This element is not rendered.
This element requires a closing tag.