Changes the color of an object over time.
When animating the color property on an object, the color must be initialized in the object's style. You must also set the attributeName to the specific color attribute you wish to animate.
The following example demonstrates how to use the t:ANIMATECOLOR element to change the color of a div over time.
<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>t:ANIMATECOLOR Demo</TITLE>
<?IMPORT namespace="t" implementation="#default#time2">
</HEAD>
<BODY>
<DIV ID="oDIV" STYLE="width:100px; height:50px; background-color:red;
text-align:center;">DIV!</DIV>
<t:ANIMATECOLOR targetElement="oDIV" attributeName="backgroundColor"
to="yellow" start="2" 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 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.
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.