|
@@ -89,13 +89,16 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
// rightclicked
|
|
|
|
|
|
javax.swing.Timer animT; // animation Timer
|
|
|
+ private final int ANIMTIME = 5000; //animation Time
|
|
|
+
|
|
|
private ArrayList<AbstractCpsObject> animCps = null;
|
|
|
private int animFPS = 30;
|
|
|
- private int animDuration = 500; // animation Duration
|
|
|
- private int animDelay = animDuration / animFPS; // animation Delay
|
|
|
+ private int animDuration = ANIMTIME; // animation Duration
|
|
|
+ private int animDelay = 1000 / animFPS; // animation Delay
|
|
|
private int animSteps = animDuration / animDelay; // animation Steps;
|
|
|
private long start = 0;
|
|
|
private long elapsedTime = 0;
|
|
|
+
|
|
|
|
|
|
// contains the value of the Capacity for new created Edges
|
|
|
|
|
@@ -164,7 +167,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
- if (animDuration - animDelay >= 0 && animCps.size() > 1) {
|
|
|
+ if (animDuration - animDelay > 0 && animCps.size() > 1) {
|
|
|
for (int i = 0; i < animCps.size(); i++) {
|
|
|
double x1 = animCps.get(i).getPosition().x;
|
|
|
double y1 = animCps.get(i).getPosition().y;
|
|
@@ -177,7 +180,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
animDuration -= animDelay;
|
|
|
animSteps--;
|
|
|
} else {
|
|
|
- animDuration = 500;
|
|
|
+ animDuration = ANIMTIME;
|
|
|
animSteps = animDuration / animDelay;
|
|
|
animT.stop();
|
|
|
for (int i = 0; i < animCps.size(); i++) {
|
|
@@ -234,7 +237,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
animDuration -= animDelay;
|
|
|
animSteps--;
|
|
|
} else {
|
|
|
- animDuration = 500;
|
|
|
+ animDuration = ANIMTIME;
|
|
|
animSteps = animDuration / animDelay;
|
|
|
animT.stop();
|
|
|
for (int i = 0; i < animCps.size(); i++) {
|