From 67438312a69f7b7aa1fdbc27610438897791ceef Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 16 Feb 2021 17:51:15 +0100 Subject: i&m: add video exercise --- Year_2/IandM/nasdaq/nasdaq.pde | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Year_2/IandM/nasdaq/nasdaq.pde (limited to 'Year_2/IandM/nasdaq/nasdaq.pde') diff --git a/Year_2/IandM/nasdaq/nasdaq.pde b/Year_2/IandM/nasdaq/nasdaq.pde new file mode 100644 index 0000000..aabc13e --- /dev/null +++ b/Year_2/IandM/nasdaq/nasdaq.pde @@ -0,0 +1,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); + } +} -- cgit v1.2.3-18-g5258