-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation.java
More file actions
83 lines (67 loc) · 1.59 KB
/
Animation.java
File metadata and controls
83 lines (67 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import javafx.scene.canvas.GraphicsContext;
import javafx.animation.AnimationTimer;
import javafx.scene.control.Label;
public class Animation
{
private GraphicsContext gc;
private Liste liste;
private AnimationTimer timer;
private Label ausgabe;
public Animation(GraphicsContext gc_, Label label_)
{
gc = gc_;
ausgabe = label_;
liste = new Liste();
infosAusgeben("Hier stehen bald Infos!");
}
public void neueBubble()
{
Bubble b = new Bubble();
liste.hintenEinfuegen(b);
neuZeichnen();
}
public void bubbleLoeschen()
{
liste.vorneEntnehmen();
neuZeichnen();
}
public void neuZeichnen()
{
gc.clearRect(0,0,400,400);
liste.zeichnen(gc);
}
public void bewegen()
{
liste.bewegen();
neuZeichnen();
}
public void zaehlen()
{
// Wie viele Bubbles sind gerade in der Liste?
// int anzahl = liste.anzahlGeben();
// infosAusgeben("Es sind gerade " + anzahl + " Bubbles");
}
public void start()
{
if (timer == null)
{
timer = new AnimationTimer() {
@Override
public void handle(long now) {
bewegen();
neueBubble();
}
};
timer.start();
}
}
public void stop()
{
timer.stop();
timer = null;
}
public void infosAusgeben(String text)
{
ausgabe.setText(text);
}
}