Last active
October 23, 2018 18:27
-
-
Save lizzybrooks/80bc5ead2d9fecc8f7be57fdfc0633a1 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
/* Flower array by Jeannie Moreno, LWHS Computing 2017 | |
*/ | |
function setup() { | |
createCanvas(900, 400); | |
rectMode(CENTER); | |
noStroke() | |
var flowerColors = [color(159,12,233), color(240,24,175),color(17,67,16), color(212,200,31) ]; | |
background(240); | |
translate(width/2, height/2); | |
//petals | |
fill(flowerColors[0]); | |
petals(); | |
//center | |
fill(flowerColors[int(random(0,flowerColors.length))]); | |
center(); | |
//outer circle ring | |
fill(17,67,16); | |
outerRing(); | |
//inner circle ring | |
fill(212,200,31); | |
innerRing(); | |
} | |
function draw(){ | |
} | |
function petals () { | |
for (var i = 0; i < 8; i++) { | |
push(); | |
//fill(color) | |
// fill(159,12,233) | |
rotate(TWO_PI * i / 8); | |
ellipse(50, 0, 70, 20); | |
pop(); | |
} | |
} | |
function center(){ | |
ellipse(0,0, 40, 40) | |
} | |
function outerRing(){ | |
for (var j = 0; j < 8; j++) { | |
push(); | |
rotate(TWO_PI * j / 8); | |
ellipse(15, 10, 7, 7); | |
pop(); | |
} | |
} | |
function innerRing(){ | |
for (var k = 0; k < 8; k++) { | |
push(); | |
rotate(TWO_PI * k / 8); | |
ellipse(6, 6, 7, 7); | |
pop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment