summaryrefslogtreecommitdiff
path: root/Year_2/IandM/nasdaq/nasdaq.pde
blob: aabc13e8d70545ed2206a7cc1d7b2d8565d8b1c9 (plain)
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
int x = 0;
int y = 500/2;

void setup() {
  size(500, 500);
  frameRate(1000);

  line(x, y, x+10, y);
  x = x+10;
}

void draw() {
  fill(255, 100);
  x = x+1;
  int ys = y+(int) random(-3, 3);
  line(x, y, x+1, ys);
  y = ys;

  if (x >= width) {
    noStroke();
    rect(0, 0, width, height);
    fill(255, 0, 0);
    rectMode(RADIUS);

    rect(x-10, y-2, 10, 2);
    x = 0;
    stroke(0);
  }
}