cls_MotionMixin - almarklein/visvis GitHub Wiki
Inherits from object.
A generic class that represents a wobject that has motion.
This class implements the basic methods to control motion. It uses the concept of the motionIndex, which is basically the time parameter. Its value specifies the position in the motion sequence with a scalar (float) value. Some motion wobject implementations may only support integer values though, in which case they should round the motionIndex.
Inheriting classes should implement _GetMotionCount() and _SetMotionIndex(index, ii, ww), where ii are four indices, and ww are four weights. Together they specify a spline.
The MotionMixin class implements the following properties:
motionCount, motionIndex, motionIsCyclic, motionSplineType
The MotionMixin class implements the following methods:
MotionPlay, MotionStop
Get the number of temporal instances of this object. For objects that do not have a fixed number of elements, the returned number may be an arbitrary large number above one thousand.
Get/set the motion index; the temporal position in the motion. With N the motionCount, if the motion is cyclic, the valid range is [0, N>, otherwise [0,N-1]. If the given index is not in the valid range, its modulo is taken (cyclic) or the index is clipped (not cyclic).
Get/set whether the motion is cyclic. Default True.
Get/set the spline type to interpolate the motion. Can be 'nearest', 'linear', 'cardinal', 'B-spline', or a float between -1 and 1 specifying the tension of the cardinal spline. Note that the B-spline is an approximating spline. Default 'linear'. Note that an implementation may not support interpolation of the temporal instances.
Start playing the motion.
This starts a timer that is triggered every interval miliseconds. On every trigger the motionIndex is increased by delta.
Stop playing the motion.