summaryrefslogtreecommitdiff
path: root/Year_2/IandM/boxes
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-02-22 16:43:59 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-02-22 16:43:59 +0100
commitcf228fd6b77a0efbdd4846d41a436663f2ae7eb1 (patch)
tree2a7925381091825982b65b3d8cff4a46830090d9 /Year_2/IandM/boxes
parent020ac5aa148c2e70aa34fb798dbbe9b8778f32a0 (diff)
i&m: gif exercises
Diffstat (limited to 'Year_2/IandM/boxes')
-rw-r--r--Year_2/IandM/boxes/boxes.movbin0 -> 4706506 bytes
-rw-r--r--Year_2/IandM/boxes/boxes.pde35
2 files changed, 35 insertions, 0 deletions
diff --git a/Year_2/IandM/boxes/boxes.mov b/Year_2/IandM/boxes/boxes.mov
new file mode 100644
index 0000000..fb995e5
--- /dev/null
+++ b/Year_2/IandM/boxes/boxes.mov
Binary files 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();
+}