ControlP5 Spacing Slider
in
Contributed Library Questions
•
10 months ago
Hey Everything,
I'm a totally newbie on Processing and for a project where I'm working on a typography generator I would like to create a slider which changes the spacing of my grid (between the lines), I mean that only the grid becomes larger. What I don't want is a zoom!
- /*
- Afficher l'interface de l'application
- */
- ////////////////////// GLOBALS //////////////////////
- ////////////////////// SETUP //////////////////////
- void setupGRILLE() {
- cp5 = new ControlP5(this);
- cp5.addToggle("toggle1")
- .setColorActive(color(#00FF00))
- .setColorLabel(color(#00FF00))
- .setLabel("Beginner")
- .setPosition(525,100)
- .setSize(50,20)
- .setValue(true)
- .setMode(ControlP5.SWITCH)
- ;
- cp5.addToggle("toggle2")
- .setColorActive(color(#00FF00))
- .setColorLabel(color(#00FF00))
- .setLabel("Intermediate")
- .setPosition(525,200)
- .setSize(50,20)
- .setValue(true)
- .setMode(ControlP5.SWITCH)
- ;
- cp5.addToggle("toggle3")
- .setColorActive(color(#00FF00))
- .setColorLabel(color(#00FF00))
- .setLabel("Advanced")
- .setPosition(525,300)
- .setSize(50,20)
- .setValue(true)
- .setMode(ControlP5.SWITCH)
- ;
- cp5.addToggle("toggle4")
- .setColorActive(color(#00FF00))
- .setColorLabel(color(#00FF00))
- .setLabel("Superheavy")
- .setPosition(525,400)
- .setSize(50,20)
- .setValue(true)
- .setMode(ControlP5.SWITCH)
- ;
- }
- ////////////////////// DRAW //////////////////////
- //Button on/off Beginner
- void toggle1(boolean vertical) {
- if(vertical==true) {
- dessineGrille = true;
- } else {
- dessineGrille = false;
- }
- }
- //Button on/off Intermediate
- void toggle2(boolean vertical) {
- if(vertical==true) {
- dessineGrille2 = true;
- } else {
- dessineGrille2 = false;
- }
- }
- //Button on/off Advanced
- void toggle3(boolean vertical) {
- if(vertical==true) {
- dessineGrille3 = true;
- } else {
- dessineGrille3 = false;
- }
- }
- //Button on/off Superheavy
- void toggle4(boolean vertical) {
- if(vertical==true) {
- dessineGrille4 = true;
- } else {
- dessineGrille4 = false;
- }
- }
- ////////////////////// FUNCTIONS //////////////////////
- //Grille verticale
- void grille1() {
- for(int x=0; x<500; x=x+50) {
- for(int y=0; y<500; y=y+50) {
- stroke(#00FF00);
- line(x,0,x,500);
- }
- }
- }
- //Grille horizontale
- void grille2() {
- for(int x=0; x<500; x=x+50) {
- for(int y=0; y<500; y=y+50) {
- stroke(#00FF00);
- line(0,y,500,y);
- }
- }
- }
- //Grille diagonale bas-gauche vers haut-droite
- void grille3() {
- for(int x=0; x<500; x=x+50) {
- for(int y=0; y<500; y=y+50) {
- stroke(#00FF00);
- line(x+50,y,x,y+50);
- }
- }
- }
- //Grille diagonale bas-droite vers haut-gauche
- void grille4() {
- for(int x=0; x<500; x=x+50) {
- for(int y=0; y<500; y=y+50) {
- stroke(#00FF00);
- line(x,y,x+50,y+50);
- }
- }
- }
Another question is if it's possible to flip for example a triangle vertically or horizontally by using a keypress.
Thanks in advance and please let me know if you need more information!
toebii.
1