The Blinking renderer

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 colors
    The 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 the Blinking renderer is installed. The first line creates a blinking color with the timings for the color taken from the Blinking renderer. The second and third lines are essentially equivalent. The fourth line creates a blinking color with multiple subcolors. Note that the Blinking renderer only enables the appropriate syntax, but it is not necessary for the blinking effect. The third and the fourth lines work even when no Blinking renderer is installed.
    Here is a concrete example:
    Color blinking
    node {
         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 paints
    The 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 blinking
    node {
        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 visibility
    The renderer property ToggleVisibility switches the visibility of the whole object periodically. The blinking timings are taken from the Blinking renderer, therefore this specification works only when the Blinking renderer is installed and enabled.
    Visibility blinking
    node {
        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 the Blinking 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.