From cf228fd6b77a0efbdd4846d41a436663f2ae7eb1 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Mon, 22 Feb 2021 16:43:59 +0100
Subject: i&m: gif exercises

---
 Year_2/IandM/boxes/boxes.mov                 | Bin 0 -> 4706506 bytes
 Year_2/IandM/boxes/boxes.pde                 |  35 ++++++++++++++++++++++
 Year_2/IandM/elettrocardio/elettrocardio.mov | Bin 0 -> 427077 bytes
 Year_2/IandM/elettrocardio/elettrocardio.pde |  43 +++++++++++++++++++++++++++
 Year_2/IandM/rote/rote.mov                   | Bin 0 -> 9644292 bytes
 Year_2/IandM/rote/rote.pde                   |  20 +++++++++++++
 6 files changed, 98 insertions(+)
 create mode 100644 Year_2/IandM/boxes/boxes.mov
 create mode 100644 Year_2/IandM/boxes/boxes.pde
 create mode 100644 Year_2/IandM/elettrocardio/elettrocardio.mov
 create mode 100644 Year_2/IandM/elettrocardio/elettrocardio.pde
 create mode 100644 Year_2/IandM/rote/rote.mov
 create mode 100644 Year_2/IandM/rote/rote.pde

(limited to 'Year_2')

diff --git a/Year_2/IandM/boxes/boxes.mov b/Year_2/IandM/boxes/boxes.mov
new file mode 100644
index 0000000..fb995e5
Binary files /dev/null and b/Year_2/IandM/boxes/boxes.mov differ
diff --git a/Year_2/IandM/boxes/boxes.pde b/Year_2/IandM/boxes/boxes.pde
new file mode 100644
index 0000000..140696e
--- /dev/null
+++ b/Year_2/IandM/boxes/boxes.pde
@@ -0,0 +1,35 @@
+void setup() {
+  size(500, 500);
+  rectMode(CENTER);
+}
+int[] th = {0, 0, 0};
+int[] y = {0, 0, 0};
+int[] x = {0, 0, 0};
+void draw() {
+  background(255);
+  
+  fill(#1ADFE8);
+  
+  line(10, height-100, width-10, height-100);
+  
+  pushMatrix();
+  if (th[0] >= 90) th[0] = y[0] = x[0] = 0;
+  translate(width/2+(x[0]--), height-150);
+  rotate(radians(th[0]++));
+  rect(0, y[0]--, 100, 100);
+  popMatrix();
+
+  pushMatrix();
+  if (th[1] <= -90) th[1] = y[1] = x[1] = 0;
+  translate(width/2+(x[1]++), height-250);
+  rotate(radians(th[1]--));
+  rect(0, y[1]--, 100, 100);
+  popMatrix();
+
+  pushMatrix();
+  if (th[2] >= 90) th[2] = y[2] = x[2] = 0;
+  translate(width/2+(x[2]--), height-350);
+  rotate(radians(th[2]++));
+  rect(0, y[2]--, 100, 100);
+  popMatrix();
+}
diff --git a/Year_2/IandM/elettrocardio/elettrocardio.mov b/Year_2/IandM/elettrocardio/elettrocardio.mov
new file mode 100644
index 0000000..f50c0a8
Binary files /dev/null and b/Year_2/IandM/elettrocardio/elettrocardio.mov differ
diff --git a/Year_2/IandM/elettrocardio/elettrocardio.pde b/Year_2/IandM/elettrocardio/elettrocardio.pde
new file mode 100644
index 0000000..293a5ad
--- /dev/null
+++ b/Year_2/IandM/elettrocardio/elettrocardio.pde
@@ -0,0 +1,43 @@
+int x = 0;
+int y = 250;
+int j = 0;
+int ys = 250;
+int xs = 0;
+int st = 0;
+void setup() {
+  size(500, 500);
+  background(#015B6C);
+}
+
+void draw() {
+  if (x >= width) {
+    background(#015B6C);
+    x = 0;
+  }
+
+  stroke(#1AFF3E);
+  strokeWeight(3);
+  if (j < 50) {
+    line(x, y, x++, y);
+  } else {
+    if (st == 0) {
+      ys = ys-(int) random(10, 70);
+      line(x, y, x+=5, ys);
+      st++;
+      y = ys;
+    } else if (st == 1) {
+      ys = y+(int) random(75, 130);
+      line(x, y, x+=5, ys);
+      st++;
+      y = ys;
+    } else {
+      line(x, y, x+=3, height/2);
+      y = height/2;
+      st = 0;
+      j = 0;
+      ys = y;
+    }
+  }
+
+  ++j;
+}
diff --git a/Year_2/IandM/rote/rote.mov b/Year_2/IandM/rote/rote.mov
new file mode 100644
index 0000000..28c4034
Binary files /dev/null and b/Year_2/IandM/rote/rote.mov differ
diff --git a/Year_2/IandM/rote/rote.pde b/Year_2/IandM/rote/rote.pde
new file mode 100644
index 0000000..1292328
--- /dev/null
+++ b/Year_2/IandM/rote/rote.pde
@@ -0,0 +1,20 @@
+void setup() {
+  size(500, 500);
+}
+
+int th = 0;
+
+void draw() {
+  background(#ffffff);
+  translate(width/2, height/2);
+  rotate(radians(th++));
+  stroke(0);
+  noFill();
+  strokeWeight(20);
+  ellipseMode(RADIUS);
+  ellipse(0, 0, 200, 200);
+  
+  noStroke();
+  fill(0);
+  triangle(0, -200, 180, 100, -180, 100);
+}
-- 
cgit v1.2.3-18-g5258