Glider

Element

A glider is a point bound to a line, circle, curve, turtle, or even another point.

Usage (signatures)
board.create('glider', [zopt, xopt, yopt, GlideObject]);

Parent elements can be two or three elements of type number and the object the glider lives on.

The coordinates are completely optional. If not given the origin is used. If you provide two numbers for coordinates they will be interpreted as affine Euclidean coordinates, otherwise they will be interpreted as homogeneous coordinates. In any case the point will be projected on the glide object.

Parameters
Name Type Attributes Description
z NumberLike <optional>
x NumberLike <optional>
y NumberLike <optional>
GlideObject JXG.GeometryElement
Examples

Create a glider with user defined coordinates on a circle

// The point will be projected onto the circle.
var p1 = board.create('point', [2.0, 2.0]);
var c1 = board.create('circle', [p1, 2.0]);
var p2 = board.create('glider', [2.0, 1.5, c1]);

Create a glider with default coordinates (0,0)

var p1 = board.create('point', [2.0, 2.0]);
var c1 = board.create('circle', [p1, 2.0]);
var p2 = board.create('glider', [c1]);

Animate glider

var p1 = board.create('point', [2.0, 2.0]);
var c1 = board.create('circle', [p1, 2.0]);
var p2 = board.create('glider', [4, 2, c1]);
var button1 = board.create('button', [1, 7, 'start animation', function(){ p2.startAnimation(1, 8); }]);
var button2 = board.create('button', [1, 5, 'stop animation', function(){ p2.stopAnimation(); }]);
Attributes

Own

none

Inherited

Members

Own

none

Inherited

Methods

Own

startAnimation(direction, stepCount, delay, maxRoundsopt) → {JXG.CoordsElement}

Animate a point.

Examples

// Divide the circle line into 6 steps and
// visit every step 330 msec counterclockwise.
var ci = board.create('circle', [[-1,2], [2,1]]);
var gl = board.create('glider', [0,2, ci]);
gl.startAnimation(-1, 6, 330);

//animate example closed curve
var c1 = board.create('curve',[(u)=>4*Math.cos(u),(u)=>2*Math.sin(u)+2,0,2*Math.PI]);
var p2 = board.create('glider', [c1]);
var button1 = board.create('button', [1, 7, 'start animation',function(){p2.startAnimation(1,8)}]);
var button2 = board.create('button', [1, 5, 'stop animation',function(){p2.stopAnimation()}]);
// Divide the slider area into 20 steps and
// visit every step 30 msec. Stop after 2 rounds.
var n = board.create('slider',[[-2,4],[2,4],[1,5,100]],{name:'n'});
n.startAnimation(1, 20, 30, 2);

Parameters

Name Type Attributes Default Description
direction Number | function

The direction the glider is animated. Can be +1 or -1.

stepCount Number | function

The number of steps in which the parent element is divided. Must be at least 1.

delay Number | function

Time in msec between two animation steps. Default is 250.

maxRounds Number <optional>
-1

The number of rounds the glider will be animated. The glider will run infinitely if maxRounds is negative or equal to Infinity.

Returns

Reference to itself.

Type
JXG.CoordsElement

Details

See
Source
base/coordselement.js, line 1772

stopAnimation() → {JXG.CoordsElement}

Stop animation.

Returns

Reference to itself.

Type
JXG.CoordsElement

Details

See
Source
base/coordselement.js, line 1866

Inherited

Events

Own

none

Inherited

Throws

If the element cannot be constructed with the given parent objects an exception is thrown.

Type
Exception

Details

Type
JXG.Point
Source
base/point.js, line 536

Extends