public abstract class LinearPositionTransition extends RTTransition<java.awt.Point>
// get the visual object its position should be changed final VisualObject vo = customView.getVisualObject(...); // create the linear position transition and use the actual runtime environment new LinearPositionTransition(this, new Point(vo.getX(), vo.getY()), new Point(100, 100)) { protected void apply(Point o) { // apply the transition object to the visual object vo.setX(o.getX()); vo.setY(o.getY()); // repaint the custom view customView.repaint(); } }.run();Attention:
RTTransition.run()
method on the transition!RTTransition
Modifier and Type | Field and Description |
---|---|
protected java.awt.Point |
source
the source position
|
protected java.awt.Point |
target
the target position
|
DEF_DURATION, DEF_STEPS, duration, frame, steps
Constructor and Description |
---|
LinearPositionTransition(AlgorithmRTE rte,
long duration,
int steps,
java.awt.Point source,
java.awt.Point target)
Creates a new linear position transition.
|
LinearPositionTransition(AlgorithmRTE rte,
java.awt.Point source,
java.awt.Point target)
Creates a new linear position transition.
|
protected final java.awt.Point source
protected final java.awt.Point target
public LinearPositionTransition(AlgorithmRTE rte, java.awt.Point source, java.awt.Point target) throws java.lang.IllegalArgumentException
RTTransition.DEF_DURATION
and the default step count RTTransition.DEF_STEPS
.rte
- the runtime environment of the related algorithmsource
- the source positiontarget
- the target positionjava.lang.IllegalArgumentException
- public LinearPositionTransition(AlgorithmRTE rte, long duration, int steps, java.awt.Point source, java.awt.Point target) 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)source
- the source positiontarget
- the target positionjava.lang.IllegalArgumentException
- < 2
protected java.awt.Point runStep(int step)
RTTransition
runStep
in class RTTransition<java.awt.Point>
step
- the current step (one-based)