• fullscreen
  • sliders_1_revB.pde
  • //-------------------------------- EXTERNAL LIBRARIES
    import controlP5.*;
    
    //-------------------------------- LIBRARY INSTANTIATIONS
    ControlP5 mySliders;
    
    //-------------------------------- SLIDERS WILL CONTROL THESE ***PUBLIC*** VARIABLES
    float myPosX = 100.0;
    float myPosY = 300.0;
    float knobR, knobG, knobB ;
    float col;
    float dim = 25;
    float bkCol;
    
    //font of text
    
    
    
    
    
    /*-----------------------------------------------------------------------------
     *** GLOBAL INIT ***
     -----------------------------------------------------------------------------*/
    void setup() {
    
      //-------------------------------- GENERAL
      smooth ();
        size(500, 500);
      background(100);
      
     
    
      //-------------------------------- CONTROLP5
      mySliders = new ControlP5(this);
    
      // controlP5.addSlider("strName", valMin, valMax, valDefault, posX, posY, sizeW, sizeY);
      mySliders.addSlider("myPosX", 0, width, myPosX, 50, 50, 200, 10);  
      mySliders.addSlider("myPosY", 0, height, myPosY, 50, 75, 200, 10);  
      mySliders.addSlider("col", 0, height, 50, 50, 100, 200, 10);  
      mySliders.addSlider ("dim", 15, 150, dim, 50, 125, 200, 10);
      
    
    //RGB dials
    // parameters  : name, minimum, maximum, default value (float, x, y, diameter
    mySliders.addKnob("knobR",0,360,0,50,height-100,50);
    mySliders.addKnob("knobG",0,360,0,150,height-100,50);
    mySliders.addKnob("knobB",0,360,0,250,height-100,50);
    
    }
    
    
    /*-----------------------------------------------------------------------------
     *** MAIN PROGRAM LOOP ***
     -----------------------------------------------------------------------------*/
    void draw() {
    
      //-------------------------------- GENERAL
     
     
      background(bkCol);
      
      stroke(col);
      fill(knobR, knobG, knobB);
      ellipse( myPosX, myPosY, dim, dim );
    }
    
    
    
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Michael Smith

    Gui experiment 1

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    Here is an experiment of creating a GUI using controlP5 libraries. Everything is self explanatory yet I cant get the dials at the bottom to display their names. any suggestions?

    Michael Smith
    6 Nov 2011
    this works on my computer but when I upload it onto open processing, it does not work. A circle should be displayed which is controlled by the parameters in the GUI. why?
    You need to login/register to comment.