Pointer API

Pointers can be used to represent pointers of a programming language. The pointer is visualized as a label with an arrow to the target of the pointer.

.pointer(name, target, [options])

This is a method of the AV object. It creates a pointer that points to some JSAV object. Parameter name is the (initial) name for the pointer. Parameter options include the following:

Note: If you do not see the pointer arrow, it might be that the pointer is positioned outside the JSAV canvas and thus is not visible. Moving the target structure down should fix the issue.

A pointer instance has the functions of the Label object as well as the following functions.

.target([newTarget], [options])

If newTarget is not specified, returns the JSAV object this pointer points to. If newTarget is a JSAV object, the pointer will be updated to point to that structure. Valid options are the same as for the pointer constructor. If setting a new target, the change is recorded in the animation and the function returns the pointer object.

Note: the position of the pointer is only updated once the jsav.step(), jsav.displayInit(), or jsav.recorded() function is called.

Example