2D Graphics > Prototypes > Predefined Accessors > Animation Accessors
 
Animation Accessors
Animation accessors (class IlvAnimationAccessor) are a category of the Display accessors that change the appearance of an object periodically. Animation accessors hold a value of a Boolean type indicating whether the animation is on.
For efficiency reasons, the Animation accessors do not reevaluate their attributes at each count of the timer. Thus, if you change one of the attributes of the accessor, you must reassign the value to itself to force an update of the parameters, using the Assign accessor for instance. See the pump prototype in the samples library for an example.
The different Animation accessors are described as follows:
*Blink
*Invert
*Rotate
Blink
The Blink accessor (class IlvBlinkAccessor) makes an object of your prototype blink, that is, it causes the object to appear and disappear at brief, regular intervals. When the attribute is set to IlTrue, the object starts blinking. When the attribute is set to IlFalse, the blinking stops.
Parameters
*Boolean Attribute: Object attribute that controls the object visibility.
*Period (ms): The interval in milliseconds between two blinks (Float or Integer).
*The type of this value is Boolean.
Example
The following example shows the file prototype in the sources library with a blink value.
Invert
The Invert accessor (class IlvInvertAccessor) inverts the color of an element of your prototype periodically. When the property is set to IlTrue, the color inversion begins. When the attribute is set to IlFalse, the color inversion stops.
While the colors are designated as the foreground and background colors, any colors defined by the prototype or one of its nodes can be used.
Parameters
*Fg Col. Attribute: Node attribute or prototype value that contains the foreground color.
*Bg Col. Attribute: Node attribute or prototype value that contains the background color.
*Period (ms): The interval, in milliseconds, between two inversions of the object colors (Float or Integer).
*Type: Boolean (whether the accessors are exchanging their values).
Example
This example is presented in the pump prototype of the samples prototype library. When invert is set to true, the values of rotorColor and invertedColor are exchanged periodically. The period is defined by the invert attribute.
Note: The invertPeriod value has an Assign behavior: invert = invert. This forces the accessors to be reevaluated and the internal timer to update its period whenever the period is changed.
Rotate
The Rotate accessor (class IlvRotateAccessor) defines a behavior that, when set to IlTrue, makes an object rotate periodically.
The Angle parameter specifies the number of degrees by which the object rotates at every timer tick. The Center X and Center Y parameters define the rotation center. You should not use the center of the rotating node itself for these parameters because the rounding problems that occur while rotating an object might move it slightly. Instead, you should use the center of another fixed object of the prototype. You can make this reference object invisible if necessary.
Parameters
*Graphic Node: Name of the node to rotate. Can be a graphic node or a subgroup node.
*Angle: Angle in degrees by which the object is rotated at each step (Float or Integer).
*Center X: X-coordinate of the rotation center. You can use the centerX accessor for this parameter (Float or Integer).
*Center Y: Y-coordinate of the rotation center. You can use the centerY accessor for this parameter (Float or Integer).
*Period (ms): The interval in milliseconds at which the object rotates. It must be an Integer.
Example
This example is presented in the pump prototype of the samples prototype library. When the Rotate accessor is set to true, the nodes will turn by 20 degrees every 10 ms.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.