-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOscillation.java
More file actions
37 lines (29 loc) · 837 Bytes
/
Oscillation.java
File metadata and controls
37 lines (29 loc) · 837 Bytes
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
import processing.core.PApplet;
public class Oscillation extends PApplet{
Cell[][] board;
int cols = 80;
int rows = 80;
public void settings(){
size(800, 800);
board = new Cell[cols][rows];
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
// init objects
board[i][j] = new Cell(i*10, j*10, 10, 10, i + j, this);
}
}
}
public void draw(){
background(0);
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
// Oscillate and display each object
board[i][j].oscillate();
board[i][j].display();
}
}
}
public static void main(String... args){
PApplet.main("Oscillation");
}
}