-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathAlgoVisualizer.java
43 lines (28 loc) · 895 Bytes
/
AlgoVisualizer.java
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
import java.awt.*;
public class AlgoVisualizer {
private static int DELAY = 40;
private CircleData data;
private AlgoFrame frame;
public AlgoVisualizer(int sceneWidth, int sceneHeight){
int R = Math.min(sceneWidth, sceneHeight)/2 - 2;
data = new CircleData(sceneWidth/2, sceneHeight/2, R, R/2, 2);
EventQueue.invokeLater(() -> {
frame = new AlgoFrame("Fractal Visualizer", sceneWidth,sceneHeight);
new Thread(() -> {
run();
}).start();
});
}
private void run(){
setData();
}
private void setData(){
frame.render(data);
AlgoVisHelper.pause(DELAY);
}
public static void main(String[] args) {
int sceneWidth = 800;
int sceneHeight = 800;
AlgoVisualizer vis = new AlgoVisualizer(sceneWidth, sceneHeight);
}
}