Skip to content

Commit

Permalink
rotate_oop/fixing .. : 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 d6d7c8e commit 6c7fd7c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 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,6 +28,8 @@ const Rotate_oop = () => {
let things = []
let R, C // used later in draw

let RandomColor

const setup = (p5, canvasParentRef) => {

/* // - Considered putting class definition HERE -
Expand Down Expand Up @@ -58,7 +60,7 @@ const Rotate_oop = () => {
Bright_gold,
Bright_green
]
const Color = Colors[Math.floor(Math.random() * Colors.length)]
RandomColor = Colors[Math.floor(Math.random() * Colors.length)]

p5.rectMode(p5.CENTER)
p5.angleMode(p5.DEGREES)
Expand All @@ -72,7 +74,7 @@ const Rotate_oop = () => {
let c = -1
things[r] = []
while (++c < C) {
p5.fill( Color )
p5.fill( RandomColor )
things[r][c] = new Something(
unit_size / 2 + r * unit_size,
unit_size / 2 + c * unit_size,
Expand All @@ -82,7 +84,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 6c7fd7c

Please sign in to comment.