Skip to content

Instantly share code, notes, and snippets.

@danaabs
Created October 14, 2015 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danaabs/43f3c81b11a485baab6b to your computer and use it in GitHub Desktop.
Save danaabs/43f3c81b11a485baab6b to your computer and use it in GitHub Desktop.
Red
var circles = [];
var paragraphs = [];
var slider;
var rwords;
var gwords;
var feeling;
var index = 0;
var button;
var clearButton;
var n = 0;
function setup() {
c = createCanvas(600, 600);
button = createButton("Add Feels");
button.mousePressed(buttonAdd);
clearButton = createButton("No Feels");
clearButton.mousePressed(clearAll);
noStroke();
noStroke();
feeling = ["strength", "warmth", "agression", "excitement", "stimulation", "defiance"];
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 g 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(this.col, val1, 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(m, 0, 0);
textStyle(BOLD);
text("R", 0, 0, 100, 100);
textSize(16);
text(feeling[index], 500, 570, 100, 100);
}
function buttonAdd() {
l = createP("strength");
m = createP("warmth");
n = createP("agression");
o = createP("excitement");
p = createP("stimulation");
q = createP("defiance");
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);
// paragraphs = [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment