Monday, March 21, 2016
Sunday, March 20, 2016
BUTTONS -- Practice (Explained)
So my goal for this project was to create more of an abstract design. I wanted to place rectangles of different sizes around my sketch. The plan was to have the rectangles be the buttons. If you click a button (rectangle), you change the background of the sketch. The buttons would already be different colors so you'd be able to tell what you would get out of it; except a shade lighter or darker. I ran into trouble with this, so what I had down (not finished) wasn't able to load. But I saved that and thought I'd post it anyways.
BUTTONS -- Practice
import controlP5.*;
ControlP5 buttons;
//?
int myColor = 255;
void setup(){
size(600,600);
//object referring to itself
buttons = new ControlP5(this);
buttons.addButton("one")
//what you get
.setValue(45,121,53)
.setPosition(10,10)
.setSize(50,50)
.setColorBackground(color(34,98,40,15))
//when you hover
.setColorForeground(color(68,134,75,15))
//text
.setColorLabel(color(255))
//when you click
.setColorActive(color(68,134,75,15))
;
buttons.addButton("two")
.setValue(1,103,2)
.setPosition(40,30)
.setSize(100,400)
.setColorBackground(color(3,131,3,15))
.setColorForeground(color(20,167,21,15))
//text
.setColorLabel(color(255))
//when you click
.setColorActive(color(20,167,21,15))
;
buttons.addButton("three")
.setValue(91,180,98)
.setPosition(10,70)
.setSize(400,100)
.setColorBackground(color(60,152,67,15))
.setColorForeground(color(91,201,99,15))
.setColorLabel(color(255))
.setColorActive(color(91,201,99,15))
;
}
void draw(){
background(myColor);
}
//?
void one(int c){
myColor = c;
}
void two(int c){
myColor = c;
}
void three(int c){
myColor = c;
}
Subscribe to:
Posts (Atom)
