SPEED Attribute | speed参数属性 | DHTML中文手册 |
Sets or retrieves the playback speed of an element relative to its parent time container.
dhtml语法
HTML <ELEMENT SPEED = fSpeed... > Scripting object.speed(speed) [ = fSpeed ]
DHTML可能的值
fSpeed Floating-point that specifies or receives the playback speed of an element relative to its parent time container.
float Element playback speed is multiplied by this value. 1.0 Default. Element playback speed is not modified. The property is read/write. The property has a default value of 1.0.
Remarks
Element playback speed is relative to its parent time container at run time. For example, if an element's parent time container and the element itself both have the speed property set to 0.5, the element plays back at 25% of its normal playback speed. That is, the parent plays at 50% and the child plays at 50% of the parent speed, yielding a 25% playback speed for the child. You can obtain an element's run-time speed by accessing the speed property exposed by the currtimestate object.
negative values cause video elements to freeze on the last frame.
a value of zero is considered invalid. the media will play at the default of 1.0 if speed is set to 0.
some media players are not able to play at the requested speed value. if the media player cannot keep up, an onoutofsync event occurs and the requested speed value is treated as invalid. as a result, the media will play back at normal speed. the rest of the timeline progresses at the specified speed value, even if the media player cannot keep up.
the speed value affects the length of the active duration of an element. if an object's speed is increased, the active duration will be shorter than the value specified in the dur attribute. if the object is slowed, the active duration will be longer than the value specified in the dur attribute.
DHTML代码范例
This example shows how to use the speed property to set the playback speed of a timeline. The time container is set to begin at zero seconds, with a duration of five seconds and speed set to 0.5 (or half of its normal speed). The child element is set to begin one second after its parent, with a duration of one second and speed set to 0.5 (half of its normal speed). The parent's speed of 0.5 multiplied by the child's speed of 0.5 equals a speed of 0.25, or 25%. Therefore, the child element plays at 25% of its normal speed, or four times its duration, yielding a total duration of four seconds. The parent's timeline plays at only 50% of its normal speed, or twice its duration, yielding a total duration of 10 seconds.
<HTML XMLNS:t="urn:schemas-microsoft-com:time"> <HEAD> <?IMPORT namespace="t" implementation="#default#time2"> <STYLE> .time{ behavior: url(#default#time2);} </STYLE> </HEAD> <BODY> <B>Document Timer:</B> <SPAN id="Timer1" class="time" dur=".01" repeatCount="indefinite" fill="hold" onrepeat="innerText=parseInt(document.body.currTimeState.activeTime);">0</SPAN> <BR><BR> <B>Time Container Timer:</B> <SPAN id="Timer2" class="time" dur=".01" repeatCount="indefinite" fill="hold" onrepeat="innerText=parseInt(t1.currTimeState.activeTime);">0</SPAN> <BR><BR> <t:excl ID="t1" begin="0; b1.onclick;" dur="5" speed="0.5"> <DIV ID="div1" CLASS="time" begin="1" DUR="1" speed="0.5" style="color:blue;font-size:1in">Hello World!</DIV> </t:excl> <BR> <BUTTON id="b1">Click to restart</BUTTON> </BODY> </HTML>
是否符合公共标准
This property is defined in Synchronized Multimedia Integration Language (SMIL) 2.0 .
Applies To
t:TRANSITIONFILTER, t:ANIMATE, t:ANIMATECOLOR, t:ANIMATEMOTION, t:ANIMATION, t:AUDIO, t:IMG, t:MEDIA, t:PAR, t:REF, t:SEQ, time2, t:VIDEO
更多语法参考
Introduction to HTML+TIME