Created
September 2, 2017 18:26
-
-
Save matthewepler/2d823149b4aec726329af3fa8c45868c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Layer { | |
constructor () { | |
// console.log('new Layer with', arg) | |
this.sides = SIDES | |
this.layerColor = null | |
this.numShapes = this.sides | |
this.angle = TWO_PI / this.numShapes | |
this.stepsOut = 8 | |
this.singleStep = (CRYSTAL_SIZE / 2) / this.stepsOut | |
this.thinStroke = 1 | |
this.thickStroke = 3 | |
this.layerColor = getRandomFromPalette(PALETTE) | |
rectMode(CENTER) | |
} | |
} | |
class Circles extends Layer { | |
constructor () { | |
super() | |
this.shapeSize = (CRYSTAL_SIZE / 2) * 0.93 | |
this.position = (CRYSTAL_SIZE / 2) - (this.shapeSize / 2) | |
} | |
render () { | |
stroke(this.layerColor) | |
strokeWeight(this.thinStroke) | |
noFill() | |
push() | |
// translate(width / 2, height / 2) | |
for (let i = 0; i <= this.numShapes; i++) { | |
ellipse(this.position, 0, this.shapeSize, this.shapeSize) | |
rotate(this.angle) | |
} | |
pop() | |
} | |
} | |
const circles = new Circles().render() // creates and renders Circle object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment