xParaEq(e, xExpr, yExpr, totalTime)

*e*- an Element reference or ID string.*xExpr*- X expression (as a string).*yExpr*- Y expression (as a string).*totalTime*- the total duration of the animation in milliseconds. If it is zero then there is no timeout.

Define your own values to pass to xParaEq(). The same arguments are passed to each of the demo elements.

**X(t)** and **Y(t)** are expressions that generate the x and y coordinates during the slide. These expressions are evaluated with the javascript **eval()** function. Within the expression you may use any valid sub-expression that eval allows and that is *in scope*. For example, you may call methods of the Math object such as Math.sin(), Math.cos(), and Math.tan(). You may also reference any global variables or functions.

One variable that is within scope for your expression is the parameter **t**. That is, **t** is the argument to the equations you provide. At each iteration, the variable **t** increments by .008 (default value).

The **Time** argument to parametricEquation() specifies the *total time* for the slide in milliseconds. If the value is zero, the slide will not *timeout*. You can stop any slide, at any time, by this assignment: **element.stop = true;**.

The values from your expressions are plotted on a coordinate system with it's origin at the center of the sliding element's container. The coordinates are then translated by the element's container's scrollLeft and scrollTop values. So the animation will remain visible if the user scrolls or resizes the element's container.

This doesn't define a circle, as you might think, it defines the ellipse bounded by the containing element's width and height.

**X(t) = **Math.cos(t*4)

**Y(t) = **Math.sin(t*4)

Run
Stop

This is a horizontal sine wave. It has a frequency of 1, which means it will trace out one sine wave within the width of it's container.

**X(t) = **Math.cos(t)

**Y(t) = **Math.sin(t*2)

Run
Stop

This is a vertical sine wave with a frequency of 4, so it will make four cycles within the height of it's container. It's axis is shifted to the left by half of it's original position (the center of it's container).

**X(t) = **Math.cos(t*8)-.5

**Y(t) = **Math.sin(t)

Run
Stop

This is a horizontal sine wave with a frequency of 6.5. It has an amplitude of .5 which represents half the height of the element's container.

**X(t) = **Math.cos(t)

**Y(t) = **.5*Math.sin(t*13)

Run
Stop

This executes a spiral, beginning at the center of the element's container.

**X(t) = **.2*t*Math.cos(t*30)

**Y(t) = **.2*t*Math.sin(t*30)

Run
Stop

*Last updated: 6 April 2005*

By your use of **X** and/or CBE and/or any Javascript from this site you consent to the GNU LGPL - please read it. If you have any questions about the license, read the FAQ and/or come to the forums.

Forum support is available at the X Library Support Forums.

1

2

3

4