summaryrefslogtreecommitdiff
path: root/Year_2/IandM
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-02-18 18:37:37 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-02-18 18:37:37 +0100
commita68d04a87c78ed9120e05e66ed1952e1ba5d6248 (patch)
treef84fbfb2e46d4082135c187849455751f65fc947 /Year_2/IandM
parentd04b4f36115e9b4e89b0b6f33c4ae53718d2eb48 (diff)
i&m: update rotation with increasing/decreasing theta
Diffstat (limited to 'Year_2/IandM')
-rw-r--r--Year_2/IandM/rotation/rotation.pde20
1 files changed, 16 insertions, 4 deletions
diff --git a/Year_2/IandM/rotation/rotation.pde b/Year_2/IandM/rotation/rotation.pde
index 33f79ad..b427779 100644
--- a/Year_2/IandM/rotation/rotation.pde
+++ b/Year_2/IandM/rotation/rotation.pde
@@ -1,13 +1,25 @@
void setup() {
size(768, 256);
+}
+
+float th = 0;
+
+void draw() {
PImage img = loadImage("lena.png");
img.resize(256, 256);
- img.filter(GRAY);
image(img, 0, 0);
- image(rotate_forward(img, radians(45)), 256, 0);
-
- image(inverse_rotate(img, radians(45)), 512, 0);
+ image(rotate_forward(img, radians(th)), 256, 0);
+
+ image(inverse_rotate(img, radians(th)), 512, 0);
+}
+
+void keyPressed() {
+ if (key == '+') {
+ th++;
+ } else if (key == '-') {
+ th--;
+ }
}
PImage rotate_forward(PImage I, float theta) {