From 516ac23c871753a886f564818276642c7e4883d0 Mon Sep 17 00:00:00 2001 From: Munus Shih Date: Thu, 9 May 2024 16:46:38 -0400 Subject: [PATCH] week 15 --- index.html | 7 +++++ js/p5clock.js | 55 +++++++++++++++++++++++++++++++++++++ weeks/15.html | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 weeks/15.html diff --git a/index.html b/index.html index fa1ccb4..3faae5c 100644 --- a/index.html +++ b/index.html @@ -305,6 +305,13 @@

Week 14

+
+ +

Week 15

+
+ +
+
diff --git a/js/p5clock.js b/js/p5clock.js index cb778da..a3a288c 100644 --- a/js/p5clock.js +++ b/js/p5clock.js @@ -83,3 +83,58 @@ let clock2 = function(p) { }; new p5(clock2, 'p5clockclock'); + +let colorClock = function(p) { + let walker = []; + let colorList = ['#F21D2F', '#F27999', '#0F398C', '#107329', '#F2911B', '#0D0D0D', '#F21D2F', '#F27999', '#0F398C', '#107329', '#F2911B', '#ffffff']; + + p.setup = function() { + p.createCanvas(335, 335); + p.noStroke(); + + for (let i = 0; i < 100; i++) { + walker.push(new Walker()); + } + }; + + p.draw = function() { + if (p.frameCount % 10000 === 0) { + p.clear(); + } + for (let i = 0; i < walker.length; i++) { + walker[i].draw(); + walker[i].walk(); + } + }; + + class Walker { + constructor() { + this.color = p.random(colorList); + this.currentRadius = p.random(p.width / 2); + this.currentAngle = p.max(p.random(360), p.random(360)); + this.currentSize = p.min(p.random(p.width / 20), p.random(p.width / 20)); + this.radWalk = (p.random(-3, 3) + p.random(-3, 3)) / 2; + this.angWalk = p.random(-0.03, 0.03); + this.sizeWalk = (p.random(-3, 3) + p.random(-3, 3)) / 2; + } + draw() { + p.fill(this.color); + p.ellipse(p.width / 2 + this.currentRadius * p.cos(this.currentAngle), + p.height / 2 + this.currentRadius * p.sin(this.currentAngle), this.currentSize); + } + walk() { + if (this.currentRadius + this.radWalk < 300) { + this.currentRadius += this.radWalk; + this.currentAngle += this.angWalk; + } + if (this.currentSize + this.sizeWalk > 0 && this.currentSize + this.sizeWalk < 20) { + this.currentSize += this.sizeWalk; + } + this.radWalk = (p.random(-3, 3) + p.random(-3, 3)) / 2; + this.angWalk = p.random(-0.03, 0.03); + this.sizeWalk = (p.random(-1, 1) + p.random(-1, 1)) / 2; + } + } +}; + +new p5(colorClock, 'p5colorclock'); diff --git a/weeks/15.html b/weeks/15.html new file mode 100644 index 0000000..7814747 --- /dev/null +++ b/weeks/15.html @@ -0,0 +1,76 @@ +
+
+

Description

+

Congratulations on the completion of the semester! Before we + celebrate, we’ll be doing a crit on your final project. Joining us + to guest crit is Richard Lehmann. After that, we’ll talk about + what’s next. Please be sure to keep in touch with us! (and continue + to code!)

+

+
+ +
+

Lecture

+

+ What's + Next +

+
+ +
+

Assignments

+ +
    +
  • +
    Submit All Assignments in Canvas
    +

    Please make sure you submit all + your assignments in teams before 5/14 at 6 PM ET. This + includes all previous projects, worksheets, final project, + your presentation, and any other assignments you may have + missed. If you have any questions, please reach out to me on + Slack or via email.

    +

    +
  • +
+
+ +
+

Resources

+ + +
+
\ No newline at end of file