The Path control is a windowless Microsoft® DirectAnimation control that animates the position of other controls along a defined vector or spline shape-based path.
To use the Path control, you must first instantiate it on the HTML page, as shown in the following syntax:
Syntax
<OBJECT ID=object CLASSID="CLSID:D7A7D7C3-D47F-11d0-89D3-00A0C90833E6"> [<PARAM NAME="property" VALUE="setting">] </OBJECT>
Parameters
| object | String identifying the object. |
| property | One of the properties in the following table. |
| setting | Value for the property. |
Path Control Properties
| Property | Description |
| AutoStart | Determines whether the Path control starts playback upon loading. |
| Bounce | Sets the path behavior to either reverse direction and return to the beginning, or stop at the end of its playback. |
| Direction | Sets the direction of the path playback. |
| Duration | Sets the duration of the path playback. |
| Library | Retrieves the DirectAnimation library reference. |
| PlayState | Retrieves the path's current playback state. |
| Relative | Determines whether the Path control starts playing from its current position or from the absolute position in the target object's coordinate space. |
| Repeat | Sets the number of times the path loops during playback. |
| Target | Sets the object that will follow the path. |
| Time | Retrieves the elapsed playback time from the start of the path. |
| TimerInterval | Sets or retrieves the length of time, in seconds.milliseconds, between path updates. |
Path Control Methods
| Method | Description |
| AddTimeMarker | Sets a marker to fire an event when playback reaches the marker position. |
| Oval | Specifies an oval structured graphics primitive to be used as the path, with starting point at top center (12 o'clock) |
| KeyFrame | Specifies points along the path, in x, y coordinates, and a designated time to reach each point. |
| Pause | Stops playback and maintains current elapsed time. |
| Play | Begins playback from the current elapsed time. |
| Polygon | Specifies a closed series of line segments to use as the path. |
| PolyLine | Specifies an open set of line segments to use as the path. |
| Rect | Specifies a rectangular structured graphics primitive to use as the path, with starting point at top left. |
| Seek | Resets the current playback position to a new, specified position. |
| Spline | Specifies a spline to be used as the path. |
| Stop | Stops playback at current elapsed time and returns path to the beginning. |
Path Control Events
| Event | Description |
| onmarker | Occurs when the path playback reaches a marker at the specified playback position, either when the Path control is playing or when it is stopped (and reaches the marker through a Seek call, for example). |
| onpause | Occurs when path playback pauses. |
| onplay | Occurs when the Path control plays back. |
| onplaymarker | Occurs when path playback reaches a marker at the specified playback position. |
| onseek | Occurs when the Path control completes a Seek call. |
| onstop | Occurs when path playback stops. |
Determines whether the path starts playback immediately after loading. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="AutoStart" VALUE=0 | -1>
Script Syntax
object.AutoStart=[fStart]
Sets the path to either stop at the end of the path or reverse direction and continue playback. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="Bounce" VALUE=0 | -1>
Script Syntax
object.Bounce=[fBounce]
Sets the direction of the path playback, either forward or reverse. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="Direction" VALUE=0 | 1>
Script Syntax
object.Direction=fDirection
Sets the duration of the path playback. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME=" Duration" VALUE=" time ">
Script Syntax
object.Duration=[ time ]
The Duration property does not take Bounce behavior into account. If the path is set to bounce, the Duration property sets the time between the start and the end of its playback, and does not include the time when the path behavior reverses direction and returns to the start of the path.
Retrieves the reference to the DirectAnimation library functions.
Script Syntax
IDALibrary=object.Library
Retrieves the path's playback state: stopped, playing, or paused. Read-only at run time.
Script Syntax
state=object.Playstate
Determines whether the Path control starts playing from its current position or from the absolute position in the target object's coordinate space. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME=Relative VALUE=0 | -1>
Script Syntax
object.Relative=fPos
The Relative property means relative to the target object's position. The target object's position is set to relative or absolute with the STYLE="POSITION: ABSOLUTE | RELATIVE" attribute.
Relative Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Sets the number of times the path loops playback. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME=" Repeat " VALUE=nRepeat >
Script Syntax
object.Repeat=[ nRepeat ]
Sets the object to follow the path. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME=" Target" VALUE=" objTarget ">
Script Syntax
object.Target=[ objTarget ]
The target object must have an initial position. This can be set with the target object's STYLE attribute, as shown in the following examples:
<IMG SRC="target1.gif" ID="target1" STYLE="position:relative">
or
<IMG SRC="target1.gif" ID="target1" STYLE="position:absolute; left=100; top=100">
Target Property example
Right-click inside the frame and select View Source to see the HTML code for this example.
Retrieves the elapsed playback time (in milliseconds) from the start of the path playback. Repetitions set with Repeat are included in returned time calculations. Read-only at run time.
Script Syntax
time=object.Time
The default length of time, in seconds.milliseconds, between the path update. Read/write at run time; write access is available at run time only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="TimerInterval" VALUE="nInterval">
Script Syntax
object.TimerInterval=nInterval
Adds marker at specified playback position, enabling author to generate an event when that playback position is reached. This method can be used or modified only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME=" AddTimeMarkerX" VALUE=" time,
markername ,
[ 0 | -1 ]">
Script Syntax
object.AddTimeMarker (
time,
"markername",
[fAbsolute] )
The onmarker event occurs whenever the path is at the specified marker, whether or not the path is playing. The onplaymarker event occurs only when the path is playing.
This example sets three time markers named MyMark, FrameFour, and FrameZero at 0.0, 4.7, and 8.0 respectively. MyMark and FrameZero are set to occur every time the path reaches that time marker, and FrameFour is set to occur only the first time the path reaches that time marker during uninterrupted playback.
<PARAM name="AddTimeMarker1" value="0.0, MyMark, 0"> <PARAM name="AddTimeMarker2" value="4.7, FrameFour, -1"> <PARAM name="AddTimeMarker3" value="8.0, FrameZero, 0">
AddFrameMarker Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Specifies x and y coordinates along the path, and a time to reach each point. The first point defines the path's starting point. This method can be used or modified only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME=" KeyFrame" VALUE=" npoints,
[ x1,
y1 ,
...,
xN,
yN ],
[ time2,
...,
timeN ]">
Script Syntax
KeyFrameArray=Array(
x1,
y,
...,
xN,
yN )
TimeFrameArray=Array(
time2 ,
...,
timeN )
object.KeyFrame(
npoints,
KeyFrameArray ,
TimeFrameArray )
The Duration property is ignored when this method is invoked.
KeyFrame Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Specifies an oval path, with its starting point at the top center point of the oval (12 o'clock position). This method can be used or modified only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="Shape" VALUE=" Oval(
xpos,
ypos,
width,
height
) ">
Script Syntax
object.Oval(
xpos ,
ypos ,
width ,
height )
Oval Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Pauses Path playback at current elapsed time and maintains current playback position.
VBscript Syntax
object.Pause
JScript Syntax
object.Pause( )
Begins Path playback at current elapsed time.
VBscript Syntax
object.Play
JScript Syntax
object.Play( )
Calls to the Play method while a path is playing are ignored.
Specifies a set of closed line segments to use as a path. The first point defines the path's starting point. This method can be used or modified only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="Shape" VALUE=" Polygon(
npoints,
[ x1,
y1,
...,
xN,
yN ]
) ">
Script Syntax
PolygonArray=Array(
x1,
y1,
...,
xN,
yN )
object.Polygon(
npoints,
PolygonArray )
The array of x, y coordinates can be specified either as an array, or as a comma-delimited string of numbers that will be passed into the coordinates.
Polygon Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Specifies a set of line segments to use as a path. The first point defines the path's starting point. This method can be used or modified only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="Shape" VALUE=" PolyLine (
npoints,
[ x1,
y1,
...,
xN,
yN ]
) ">
Script Syntax
PolyLineArray=Array(
x1,
y1,
...,
xN,
yN )
object.PolyLine (
npoints,
PolyLineArray
)
Polyline Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Specifies a rectangular path, with its starting point at the top left point of the rectangle. This method can be used or modified only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="Shape" VALUE="Rect(
xpos,
ypos,
width,
height ) ">
Script Syntax
object.Rect (
xpos ,
ypos ,
width ,
height )
Rect Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Seeks to another position in the Path playback.
Script Syntax
object.Seek (
time )
Specifies a vector spline to be used as a path. The first point defines the path's starting point. This method can be used or modified only when the path is stopped.
PARAM Tag Syntax
<PARAM NAME="Shape" VALUE=" Spline(
npoints,
[ x1,
y1,
x2,
y2... ]
) ">
Script Syntax
object.Spline (
npoints,
[ x1,
y1,
x2,
y2... ] )
You need to specify four points for each curve in the spline. You can specify the array of x, y coordinates either as an array or as a comma-delimited string of numbers that will be passed as the coordinate set. The number of points in the spline and their spacing can have an effect on the path's speed. Having too many points too close together along the path can cause the path to seem as if it is slowing down when it traverses those points.
Spline Method example
Right-click inside the frame and select View Source to see the HTML code for this example.
Stops playback of the path at the current position and rewinds the path to its beginning.
VBscript Syntax
object.Stop
JScript Syntax
object.Stop( )
Occurs when the path playback reaches a marker at the specified playback position.
VBScript Syntax
Sub object _ onmarker (
markername )
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmarker (
markername ) >
script
<SCRIPT>
This event occurs whenever playback reaches the marker point, either when the path is playing or stopped. For example, if you seek to the marker position while the path is paused or stopped, the onmarker event will occur.
Occurs when path playback is paused.
VBScript Syntax
Sub object _ onpause ( )
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onpause >
script
<SCRIPT>
Occurs when path playback starts.
VBScript Syntax
Sub object _ onplay ( )
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onplay >
script
<SCRIPT>
Occurs when a marker is reached during path playback.
VBScript Syntax
Sub object _ onplaymarker (
markername )
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onplaymarker (
markername ) >
script
<SCRIPT>
Occurs after a Seek call has been completed.
VBScript Syntax
Sub object _ onseek (
newtime )
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onseek (
newtime ) >
script
<SCRIPT>
Occurs when the path stops playing.
VBScript Syntax
Sub object _ onstop ( )
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onstop >
script
<SCRIPT>
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.