Partilhar via


SPEED Attribute | speed Property

This topic documents a feature of HTML+TIME 2.0, which is obsolete as of Windows Internet Explorer 9.

Sets or gets the playback speed of an element relative to its parent time container.

Syntax

HTML <ELEMENT SPEED = fSpeed... >
Scripting [ fSpeed = ] object.speed [ = fSpeed ]

Possible Values

fSpeed Floating-point that specifies or receives the playback speed of an element relative to its parent time container.
value
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 the parent time container for an element and the element both have the speed property set to 0.5, the element plays back at 25 percent of its usual playback speed. That is, the parent plays at 50 percent, and the child plays at 50 percent of the parent speed, yielding a 25 percent playback speed for the child. You can obtain the runtime speed for an element 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 cannot 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 plays back at its usual 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 is shorter than the value specified in the DUR attribute. If the object is slowed, the active duration is longer than the value specified in the DUR attribute.

Example

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 one-half its usual 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 (one-half its usual speed). The parent speed of 0.5 multiplied by the child speed of 0.5 results in a speed of 0.25, or 25 percent. Therefore, the child element plays at 25 percent of its usual speed, or four times its duration, yielding a total duration of 4 seconds. The parent timeline plays at only 50 percent of its usual speed, or two times 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>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/speed.htm

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

See Also

Introduction to HTML+TIME