Created
October 14, 2015 14:58
-
-
Save danaabs/ff29481cda41d1ad0237 to your computer and use it in GitHub Desktop.
Green
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
var circles = []; | |
var paragraphs = []; | |
var slider; | |
var rwords; | |
var gwords; | |
var feeling; | |
var index = 0; | |
var button; | |
var clearButton; | |
var n = 0; | |
function setup() { | |
createCanvas(600, 600); | |
// frameRate(5); | |
button = createButton("Add Feels"); | |
button.mousePressed(buttonAdd); | |
clearButton = createButton("No Feels"); | |
clearButton.mousePressed(clearAll); | |
noStroke(); | |
noStroke(); | |
feeling = ["balance", "rest", "stagnation", "boredom", "refreshment", "peace"]; | |
rwords = createP("r value"); | |
gwords = createP("g words"); | |
bwords = createP("b words"); | |
slider1 = createSlider(0, 255, 10); | |
slider1.position(250, 615); | |
slider2 = createSlider(0, 255, 10); | |
slider2.position(250, 650); | |
slider3 = createSlider(0, 255, 10); | |
slider3.position(250, 685); | |
rwords.style("font-family", "monospace"); | |
rwords.style("font-size", "12pt"); | |
gwords.style("font-family", "monospace"); | |
gwords.style("font-size", "12pt"); | |
bwords.style("font-family", "monospace"); | |
bwords.style("font-size", "12pt"); | |
} | |
function mousePressed() { | |
index++; | |
if (index == 6) { | |
index = 0; | |
} | |
}; | |
function draw() { | |
var b = slider3.value(); | |
background(b); | |
rwords.html("The r Value: " + slider1.value()); | |
gwords.html("The b Value: " + slider2.value()); | |
bwords.html("The background Value: " + slider3.value()); | |
var val1 = slider1.value(); | |
var val2 = slider2.value(); | |
var a = 600; | |
for (var i = 0; i < 6; i++) { | |
circles[i] = { | |
x: random(width / 2, width / 2 + 0.7), | |
y: random(height / 2, height / 2 + 0.7), | |
dia: a - i * 100, | |
col: 25 + 50 * i, | |
display: function() { | |
fill(val1, this.col, val2); | |
ellipse(this.x, this.y, this.dia, this.dia); | |
} | |
} | |
}; | |
for (var i = 0; i < circles.length; i++) { | |
circles[i].display(); | |
} | |
fill(190); | |
for (var i = 0; i < 6 ; i++){ | |
text((25+i*50), (270-i*50), 300, 10, 10); | |
} | |
// text("25", 20, 300, 10, 10); | |
// text("75", 70, 300, 10, 10); | |
// text("125", 120, 300, 10, 10); | |
// text("175", 170, 300, 10, 10); | |
// text("225", 220, 300, 10, 10); | |
// text("250+", 270, 300, 10, 10); | |
textSize(50); | |
var m = map(b, 0, 255, 255, 0) | |
fill(0, m, 0); | |
textStyle(BOLD); | |
text("G", 0, 0, 100, 100); | |
textSize(16); | |
text(feeling[index], 500, 570, 100, 100); | |
} | |
function buttonAdd() { | |
l = createP("balance"); | |
m = createP("rest"); | |
n = createP("stagnation"); | |
o = createP("boredom"); | |
p = createP("refreshment"); | |
q = createP("peace"); | |
l.position(random(600, windowWidth), random(windowHeight)); | |
m.position(random(600, windowWidth), random(windowHeight)); | |
n.position(random(600, windowWidth), random(windowHeight)); | |
o.position(random(600, windowWidth), random(windowHeight)); | |
p.position(random(600, windowWidth), random(windowHeight)); | |
q.position(random(600, windowWidth), random(windowHeight)); | |
paragraphs.push(l); | |
paragraphs.push(m); | |
paragraphs.push(n); | |
paragraphs.push(o); | |
paragraphs.push(p); | |
paragraphs.push(q); | |
} | |
function clearAll() { | |
// for (var i = 0; i < paragraphs.length; i++) { | |
// paragraphs[i].remove(); | |
// } | |
paragraphs[0].remove(); | |
paragraphs.splice(0, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment