Skip to content

Commit

Permalink
rotate_oop/fixed . revert : switching colors green&gold
Browse files Browse the repository at this point in the history
  • Loading branch information
nuoxoxo committed Feb 8, 2024
1 parent 6c7fd7c commit 2f7fef9
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/p5components/Rotate_oop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Rotate_oop = () => {
this.size = size
}

_rotate( p5 ) { // passing p5 instance HERE, let p5.func get through
_rotate(p5) { // passing p5 instance HERE, let p5.func get through
p5.push()
p5.translate(this.c, this.r)
let angle = p5.atan2(p5.mouseY - this.r, p5.mouseX - this.c)
Expand All @@ -28,8 +28,6 @@ const Rotate_oop = () => {
let things = []
let R, C // used later in draw

let RandomColor

const setup = (p5, canvasParentRef) => {

/* // - Considered putting class definition HERE -
Expand All @@ -53,19 +51,11 @@ const Rotate_oop = () => {
*/

p5.createCanvas(800, 800).parent(canvasParentRef)

const Bright_gold = p5.color(250,215,0,100)
const Bright_green = p5.color('#AAFF00')
const Colors = [
Bright_gold,
Bright_green
]
RandomColor = Colors[Math.floor(Math.random() * Colors.length)]

p5.rectMode(p5.CENTER)
p5.angleMode(p5.DEGREES)
p5.noStroke()

const Bright_gold = p5.color(250,215,0,100)
R = p5.height / unit_size
C = p5.width / unit_size
let r = -1
Expand All @@ -74,7 +64,7 @@ const Rotate_oop = () => {
let c = -1
things[r] = []
while (++c < C) {
p5.fill( RandomColor )
p5.fill(Bright_gold)
things[r][c] = new Something(
unit_size / 2 + r * unit_size,
unit_size / 2 + c * unit_size,
Expand All @@ -84,7 +74,7 @@ const Rotate_oop = () => {
}
}

const draw = ( p5 ) => {
const draw = (p5) => {
p5.background(0)
let r = -1, c
while (++r < R) {
Expand Down

0 comments on commit 2f7fef9

Please sign in to comment.