Stretching the concept of flying text in Dynamic HTML one step further, this article describes how to fly text through a pathin this particular case, an oval path.
In general, flying text is implemented by manipulating the position of elements on a page over time through dynamic positioning. The Flying Text article covers the details of flying text through positioning. The article flies text through a straight pathvertical, horizontal, or diagonalon a specified increment. Although flying text through a more complex path through positioning is possible, it requires a geometric algorithm to implement. The How to Fly Text in Geometric Patterns article demonstrates how to do this by flying text diagonally on a page using a little bit of algebra to calculate different slopes.
The sample described in this article uses the DirectAnimation path control, which makes implementation very easy with a few lines of code. By simply specifying a target object to be moved, the path control moves the object around the page over time in a geometric pattern. One limitation to using the path control is that it's specific to Microsoft® Internet Explorer 4.0.
The following steps outline how to fly text through an oval path.
The path control requires the top and left properties (or CSS attributes) of the target object be set. Since the text being defined here is the target object, the top and left attributes have been set below.
Deciding whether to use absolute or relative position depends on where the text is with respect to the rest of the document. Whereas absolute removes the object from the default flow of the document, allowing the object to be positioned as specified in the (top,left) attributes, relative positions the object at an offset from where it's supposed to be in the flow. For more information, see Positioning.
<span ID="TextToFly" STYLE="position: absolute; top: 125; left:70; font: bold 20pt 'Arial'; color:white"> http://msdn.microsoft.com/workshop</span>
Because it's an ActiveX® control, the path control is inserted into the page with an OBJECT element, specifying the correct CLASSID. This CLASSID is unique to the path control and should be specified exactly as shown in the sample.
Specify the parameters to the path control as follows:
<OBJECT ID="pthOval" CLASSID = "CLSID:D7A7D7C3-D47F-11D0-89D3-00A0C90833E6" <PARAM NAME="Duration" VALUE="2"> <PARAM NAME="Shape" VALUE="Oval(-1400,100,1400,200)"> <PARAM NAME="AddTimeMarker1" VALUE="1.0, HalfwayPt, 0"> <PARAM NAME="Target" VALUE="TextToFly"> </OBJECT>
<SCRIPT LANGUAGE="JavaScript" FOR="pthOval" EVENT= onplaymarker ("HalfwayPt")> pthOval.Stop; </SCRIPT>
<script> pthOval.Play; </script>
Click the Show Me button to see a working sample and view the source code. The sample is part of a slide show presentation and has been set up to work with a specific configuration. The sample is best viewed on an 800 x 600 display, with the browser set to full-screen mode. (The sample also applies a transition to the company logo, which is not covered in this article. See How to Apply a Transition on an Image.)
The following links provide more information about flying text through a path.