TO Attribute | to参数属性 | DHTML中文手册 |
Sets or retrieves the ending value of a color attribute or property animated by t:animatecolor
dhtml语法
HTML <t:ANIMATECOLOR TO = vValue... > Scripting t:ANIMATECOLOR.to(val) [ = vValue ]
DHTML可能的值
vValue Variant that specifies or receives the ending value of the animation. The property is read/write. The property has no default value.
Remarks
The by property cannot be used on the same element as the to property. if both properties are specified, the by value is ignored.
in the context of t:animatecolor, valid attribute values are hexadecimal rgb values or the keywords that represent them (for example, #8a2be2 or blueviolet). for more information about supported color values, see the color table.
setting the to property without also setting the from property can affect values set for the additive property. for more information, see the additive reference.
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.to='#7FFFD4'; object.beginElement(); </SCRIPT>For the animate, animatemotion, and animatecolor objects, the time2 behavior uses the following model to evaluate which properties to animate.
dhtml代码范例
the following example uses two t:animatecolor elements to animate the backgroundcolor of two div elements, outerdiv and innerdiv. the inner div begins with its backgroundcolor set to yellow, which is animated to red over a five-second duration. the outer div is animated from red to yellow over the same duration.
the show me example provides several colored buttons; clicking one of them sets the from attribute of the inner div's animation element to that button's color value, and likewise sets the to attribute of the outer div's animation element.
<HTML XMLNS:t ="urn:schemas-microsoft-com:time"> <HEAD> <STYLE> .time {behavior: url(#default#time2);} </STYLE> <?IMPORT namespace="t" implementation="#default#time2"> </HEAD> <BODY> <t:PAR id="p1" begin="0" dur="15" fill="hold"> <t:ANIMATECOLOR id="a1" attributeName="background-color" from="red" to=" yellow" targetElement="outerDIV" begin="0" dur="5" fill="hold"/> <t:ANIMATECOLOR id="a2" attributeName="background-color" from="yellow" to="red" targetElement="innerDIV" to="#0000FF" begin="0" dur="5" fill="hold"/> </t:PAR> <DIV id="outerDIV" class="time" style="FONT-SIZE: 18px; LEFT: 118px; BORDER: black 1px solid; WIDTH: 279px; POSITION: absolute; TOP: 240px; HEIGHT: 217px; BACKGROUND-COLOR: red; TEXT-ALIGN: left; padding-left:3"> outerDIV</DIV> <DIV id="innerDIV" class="time" style="FONT-SIZE: 18px; LEFT: 162px; WIDTH: 188px; POSITION: absolute; TOP: 298px; HEIGHT: 98px; BACKGROUND-COLOR: yellow; TEXT-ALIGN: left; padding-left:3">innerDIV</DIV> </BODY> </HTML>
applies to
t:ANIMATECOLOR
更多语法参考
introduction to html+time, Color Table