FROM Attribute | from参数属性 | DHTML中文手册 |
Sets or retrieves the starting value of an animation.
dhtml语法
HTML <ELEMENT FROM = vValue... > Scripting object.from(val) [ = vValue ]
DHTML可能的值
vValue Variant that specifies or receives the starting value of the animation. This value can include any of the following length unit designators: px, in, cm, mm, pt, pc. For more information about the supported length units, see the CSS Length Units Reference. The property is read/write. The property has no default value.
Remarks
If a from value is not specified, the animation uses the attribute's value at the time the animation is started.
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.from='100px'; object.beginElement(); </SCRIPT>For the animate, animatemotion, and animatecolor objects, the time2 behavior uses the following model to evaluate which properties to animate.
To change an active animation from a path to a from value through script:
- The path property overrides any setting for the values, from, to, or by properties.
- 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.
<SCRIPT> object.endElement(); object.path=null; object.from='100px'; object.beginElement(); </SCRIPT>
DHTML代码范例
This example uses the from property to set the starting value of the animation.
<HTML XMLNS:t ="urn:schemas-microsoft-com:time"> <HEAD> <?IMPORT namespace="t" implementation="#default#time2"> <STYLE> .time{ behavior: url(#default#time2);} </STYLE> </HEAD> <BODY> <!-- The ANIMATE element that facilitates animation of the DIV. --> <t:ANIMATE ID="oAnim" AUTOREVERSE="true" begin="2" targetElement="div1" attributeName="left" from="100px" dur="5" to="200px" fill="hold"/> <!-- The DIV that is being animated --> <DIV id="div1" class="time" style="position:absolute;left:0px; top:170px; background-color:#003399;color:#FFCC00"> Moving DIV</DIV> </BODY> </HTML>
是否符合公共标准
This property is defined in Synchronized Multimedia Integration Language (SMIL) 2.0 .
Applies To
t:ANIMATE, t:ANIMATECOLOR, t:ANIMATEMOTION
更多语法参考
introduction to html+time, by, to