Line 19: | Line 19: | ||
<br> | <br> | ||
http://www.openprocessing.org/sketch/226732 | http://www.openprocessing.org/sketch/226732 | ||
== Sketch == | |||
<br> | |||
import controlP5.*; | |||
ControlP5 cp5; | |||
Slider abc; | |||
int posX = 350; | |||
float radiusKlein = 200; | |||
float radiusGross = 350; | |||
float linienStaerke = 1; | |||
float sliderValue = 0.1; | |||
boolean buttonState1 = true; | |||
boolean buttonState2 = false; | |||
void setup() { | |||
size(450, 450); | |||
cp5 = new ControlP5(this); | |||
// add a horizontal sliders, the value of this slider will be linked | |||
// to variable 'sliderValue' | |||
cp5.addSlider("sliderValue") | |||
.setPosition(10, 10) | |||
.setSize(100, 10) | |||
.setRange(0.5, 60) | |||
; | |||
cp5.addButton("switchCapitals") | |||
.setValue(0) | |||
.setPosition(10, 25) | |||
.setSize(100, 20) | |||
; | |||
}; | |||
void draw() { | |||
background(255); | |||
linienStaerke = sliderValue; | |||
strokeWeight(linienStaerke); | |||
//////////// g //////////////// | |||
if (buttonState1 == true) { | |||
pushMatrix(); | |||
translate(350, 50); | |||
ellipseMode(CORNER); | |||
rotate(PI/2); | |||
ellipse(0, 0, radiusKlein, radiusKlein); | |||
popMatrix(); | |||
line(350, 50, 350, 300); | |||
ellipseMode(CENTER); | |||
arc((posX - 200/2), 300, 200, 200, 0, HALF_PI*1.4); | |||
noFill(); | |||
}; | |||
//////////// G //////////////// | |||
if (buttonState2 == true) { | |||
arc(225, 225, radiusGross, radiusGross, 0, PI*1.75); | |||
line(200, 225, 400, 225); | |||
}; | |||
}; | |||
// change state of buttonA for lower g | |||
public void switchCapitals(int theValue) { | |||
println("a button event from buttonA: "+theValue); | |||
buttonState1 = !buttonState1; | |||
buttonState2 = !buttonState2; | |||
}; |
Revision as of 17:01, 29 October 2015
Benjamin Voßler
— Benjamin Voßler 15:14, 27 October 2015 (UTC)
Letter G/g
I decided to design the letter "G" for any reason.
I added a slider and a button from the controlP5 Library. Maybe that's the reason why the sketch isn't working properly on "openprocessing.org".
http://www.openprocessing.org/sketch/226732
Sketch
import controlP5.*;
ControlP5 cp5;
Slider abc;
int posX = 350; float radiusKlein = 200; float radiusGross = 350;
float linienStaerke = 1; float sliderValue = 0.1;
boolean buttonState1 = true; boolean buttonState2 = false;
void setup() {
size(450, 450);
cp5 = new ControlP5(this);
// add a horizontal sliders, the value of this slider will be linked // to variable 'sliderValue' cp5.addSlider("sliderValue") .setPosition(10, 10) .setSize(100, 10) .setRange(0.5, 60) ;
cp5.addButton("switchCapitals") .setValue(0) .setPosition(10, 25) .setSize(100, 20) ;
};
void draw() {
background(255); linienStaerke = sliderValue; strokeWeight(linienStaerke);
//////////// g //////////////// if (buttonState1 == true) { pushMatrix(); translate(350, 50); ellipseMode(CORNER); rotate(PI/2); ellipse(0, 0, radiusKlein, radiusKlein); popMatrix(); line(350, 50, 350, 300); ellipseMode(CENTER); arc((posX - 200/2), 300, 200, 200, 0, HALF_PI*1.4); noFill(); };
//////////// G //////////////// if (buttonState2 == true) { arc(225, 225, radiusGross, radiusGross, 0, PI*1.75); line(200, 225, 400, 225); };
};
// change state of buttonA for lower g public void switchCapitals(int theValue) {
println("a button event from buttonA: "+theValue); buttonState1 = !buttonState1; buttonState2 = !buttonState2;
};