Beispiel #1
0
  public void InitButton() {
    // Set zero acc e gyro
    controlP5
        .addButton("SET_ZERO")
        // .setValue(0)
        .setPosition(450, 50)
        .setSize(60, 20)
        .setColorBackground(c_blue);

    // Read PID parameter
    controlP5
        .addButton("READ_PID")
        // .setValue(0)
        .setPosition(450, 90)
        .setSize(60, 20)
        .setColorBackground(c_blue);

    // Write PID parameter
    controlP5
        .addButton("WRITE_PID")
        // .setValue(0)
        .setPosition(450, 130)
        .setSize(60, 20)
        .setColorBackground(c_blue);

    // Write PID parameter
    controlP5
        .addButton("SAVE_PID")
        //  .setValue(0)
        .setPosition(450, 170)
        .setSize(60, 20)
        .setColorBackground(c_blue);
    /*
          // START
      controlP5.addButton("START")
         .setPosition(650,50)
         .setSize(60,20)
         .setColorBackground(c_blue)
         ;

      // STOP
      controlP5.addButton("STOP")
         .setPosition(650,90)
         .setSize(60,20)
         .setColorBackground(c_blue)
         ;
    */
  }
  public void setup() {
    size(800, 600);
    background(255);

    // Local variables to set where the components will be
    int margin = 16;
    int spacing = 36;
    int w = 128;
    int h = 32;

    // Initialize ControlP5
    controlP5 = new ControlP5(this);
    // Set the color of the labels
    controlP5.setColorLabel(color(255, 0, 0));

    // Add components
    controlP5.addButton("Clear Screen", 1, margin, spacing, w, h);
    controlP5.addSlider("Leaf Red", 0, 255, 255, margin, spacing * 2, w, h);
    controlP5.addSlider("Leaf Green", 0, 255, 64, margin, spacing * 3, w, h);
    controlP5.addSlider("Leaf Blue", 0, 255, 0, margin, spacing * 4, w, h);
    controlP5.addSlider("Branch Random", 0, PI, PI / 4, margin, spacing * 5, w, h);
    controlP5.addSlider("Leaf Random", 0, 32, 16, margin, spacing * 6, w, h);
    controlP5.addSlider("Leaf Size", 0, 32, 16, margin, spacing * 7, w, h);
    controlP5.addSlider("Start Size", 0, 128, 64, margin, spacing * 8, w, h);
  }
Beispiel #3
0
  public void setup() {
    size(1024, 768);
    background(0);
    frameRate(30);
    smooth();

    drawVectors = false;

    paused = true;

    timeline = new Timeline();

    sim = new GravitySimulation();

    sun = new Star(5000, 25, new PVector(300, 500), new PVector(0, 0), 0, "sun");
    planet = new Planet(10, 10, new PVector(500, 500), new PVector(0, 40), "planet");
    planet2 = new Planet(50, 10, new PVector(150, 500), new PVector(0, -40), "planet2");

    timeline.registerStatefulObject(sun);
    timeline.registerStatefulObject(planet);
    timeline.registerStatefulObject(planet2);

    controlP5 = new ControlP5(this);

    btnRewind = controlP5.addButton("btnRewind_OnClick", 0, 800, 20, 50, 20);
    btnRewind.setLabel("Rewind");

    btnPlayPause = controlP5.addButton("btnPlayPause_OnClick", 0, 860, 20, 50, 20);
    btnPlayPause.setLabel("Play");

    btnFastForward = controlP5.addButton("btnFastForward_OnClick", 0, 920, 20, 80, 20);
    btnFastForward.setLabel("Fast Forward");

    sliderTimeline = controlP5.addSlider("sliderTimeline_OnClick", 0, 10000, 0, 20, 720, 900, 10);
    sliderTimeline.setLabel("Timeline");
  }