The
Blinking
renderer offers a convenient API to obtain color or visibility
blinking on graphic objects. It allows you to specify a uniform
timing for all graphic objects with visibility blinking:
SDM { Blinking : "true"; } Blinking { onPeriod : 1000; // Every second offPeriod : 1000; // Every second }
The blinking can be defined in CSS in
different ways:
- Toggling between colorsThe classes IlvBlinkingColor and IlvBlinkingMultiColor represent blinking colors. They can be used as Color for various properties of graphic objects that support blinking.The following example illustrates how to specify a blinking color in CSS:
@|blinkinColor(color1,color2) @|blinkinColor(color1,color2,color1Timing,color2Timing) Bcolor1Timing/color2Timimg[color1/color2] Btiming[color1/color2/color3/...]
The first two lines work only when theBlinking
renderer is installed. The first line creates a blinking color with the timings for the color taken from theBlinking
renderer. The second and third lines are essentially equivalent. The fourth line creates a blinking color with multiple subcolors. Note that theBlinking
renderer only enables the appropriate syntax, but it is not necessary for the blinking effect. The third and the fourth lines work even when noBlinking
renderer is installed.Here is a concrete example:Color blinkingnode { class: "ilog.views.sdm.graphic.IlvGeneralNode"; label: "@name"; // toggles from red to black (2 states) fillColor1: "B1000/1000[red/black]"; // toggles from red to yellow (2 states) fillColor2: "@|blinkingColor(red,yellow)"; // toggles from black to transparent red to yellow (3 states) labelColor: "B500[black/#aaff0000/yellow]"; }
- Toggling between paintsThe classes IlvBlinkingPaint and IlvBlinkingMultiPaint represent blinking paints. They can be used as Paint for various properties of graphic objects that support blinking. Blinking paints work even when no
Blinking
renderer is installed.The following example illustrates how to specify a blinking paint in CSS:Paint blinkingnode { class: "ilog.views.graphic.IlvGeneralPath"; fillPaint: "@=fillPaint"; fillOn: "true"; } Subobject#fillPaint { class: "ilog.views.util.java2d.IlvBlinkingPaint(onPaint,offPaint,onPeriod,offPeriod)"; onPaint: "@#onPaint"; offPaint: "@#offPaint"; onPeriod: "1000"; offPeriod: "1000"; } Subobject#onPaint { class: "java.awt.GradientPaint(point1,color1,point2,color2)"; point1: "0.0,0.0"; color1: "white"; point2: "72.0,72.0"; color2: "255,0,51"; } Subobject#offPaint { class: "java.awt.GradientPaint(point1,color1,point2,color2)"; point1: "0.0,0.0"; color1: "255,0,51"; point2: "72.0,72.0"; color2: "white"; }
- Toggling the visibilityThe renderer property
ToggleVisibility
switches the visibility of the whole object periodically. The blinking timings are taken from theBlinking
renderer, therefore this specification works only when theBlinking
renderer is installed and enabled.Visibility blinkingnode { class: "ilog.views.sdm.graphic.IlvGeneralNode"; ToggleVisibility: "true"; }
When you use this specification, the visibility is toggled with the same timings for all the objects. You can also specify individual timings per node; this does not require theBlinking
renderer to be installed. It is illustrated in the following example:node { class: "ilog.views.sdm.graphic.IlvGeneralNode"; blinkingOnPeriod: 1000; blinkingOffPeriod: 1000; }
The following table lists the global properties of the
Blinking
renderer.
Global properties of the Blinking
renderer
Property
|
Type
|
Default
|
Description
|
---|---|---|---|
onPeriod
|
int
|
1000
|
The duration, in milliseconds, of the first color specified in
the
blinkingColor
function, or of the visible period when
ToggleVisibility
is set to
true
.
|
offPeriod
|
int
|
1000
|
The duration, in milliseconds, of the second color specified in
the
blinkingColor
function, or of the invisible period when
ToggleVisibility
is set to
true
.
|
The following table lists the per-object properties of the
Blinking
renderer.
Per-object properties of the Blinking
renderer
Property
|
Type
|
Default
|
Description
|
---|---|---|---|
ToggleVisibility
|
boolean
|
false
|
If the value of this property is
true
, the graphic representation will toggle the visibility.
|
See the class IlvBlinkingRenderer for more details.