public abstract class ColorTransition extends RTTransition<java.awt.Color>
GraphView
):
// get the visual vertex its background should be changed final VisualVertex vv = graph.getVisualVertexByID(...); // create the color transition and use the actual runtime environment new ColorTransition(this, vv.getBackground(), Color.blue) { protected void apply(Color o) { // apply the transition object to the vertex vv.setBackground(o); // repaint the graph view graphView.repaint(); } }.run();Attention:
RTTransition.run()
method on the transition!RTTransition
Modifier and Type | Field and Description |
---|---|
protected java.awt.Color |
from
the source color
|
protected java.awt.Color |
to
the destination color
|
DEF_DURATION, DEF_STEPS, duration, frame, steps
Constructor and Description |
---|
ColorTransition(AlgorithmRTE rte,
java.awt.Color from,
java.awt.Color to)
Creates a new color transition.
|
ColorTransition(AlgorithmRTE rte,
long duration,
int steps,
java.awt.Color from,
java.awt.Color to)
Creates a new color transition.
|
protected final java.awt.Color from
protected final java.awt.Color to
public ColorTransition(AlgorithmRTE rte, java.awt.Color from, java.awt.Color to) throws java.lang.IllegalArgumentException
RTTransition.DEF_DURATION
and the default step count RTTransition.DEF_STEPS
.rte
- the runtime environment of the related algorithmfrom
- the source colorto
- the destination colorjava.lang.IllegalArgumentException
- public ColorTransition(AlgorithmRTE rte, long duration, int steps, java.awt.Color from, java.awt.Color to) throws java.lang.IllegalArgumentException
rte
- the runtime environment of the related algorithmduration
- the duration of the transition in millisecondssteps
- the step count of the transition (an animation frame is duration / steps
milliseconds long)from
- the source colorto
- the destination colorjava.lang.IllegalArgumentException
- < 2
protected final java.awt.Color runStep(int step)
RTTransition
runStep
in class RTTransition<java.awt.Color>
step
- the current step (one-based)