Loading...
Logo
Processing Forum
As the title says - the slider does not respond to clicks. What to do? Here's my code*:

*it's probably not the neatest of codes, I'm just hacking away at this, like the newbie I am. Might be related to my problem. :)

float r = 75; 
float theta = 0;
int t = 1;
int frb=1;

import controlP5.*;

ControlP5 cp5;

int sliderValue = 100;

Slider abc;



void setup() {

  size(800, 800);
  background(255, 200);
  smooth();
  frameRate(60);
  
  cp5 = new ControlP5(this);
    // add a horizontal sliders, the value of this slider will be linked
  // to variable 'sliderValue' 
  cp5.addSlider("sliderValue")
    .setPosition(-300, -300)
      .setRange(0, 255)
        ;

}

void draw() {
   sliderValue=frb;
  translate(width/2, height/2);
  pushMatrix();
 

  background(255); //tried to set alpha very low. didnt work.
  translate(1, 1);
  
  for (int i = 1; i<70; i++) {

    // Polar to Cartesian conversion
    float x = r * cos(theta);
    float y = r * sin(theta);
    //float x = (sin(frb));


    stroke(i/3, 3);
    noFill();
    //ellipse(pow(x, i/340) + width/2 -random(i*2), y + height/2, i, y);
    ellipse(frb, x, 20, y);


   rotate(frb/1000);


    // Increment the angle
    theta += .05;
    t = t+1;
  }
  popMatrix();
}


Would love any help.

Thanks!

Replies(1)

Sorted.  translate() and rotate() were giving me trouble. If anyone's interested:

float r = 75; 
float theta = 0;
int t = 1;
int frb=1;

import controlP5.*;

ControlP5 cp5;
int myColor = color(0, 0, 0);

int sliderValue = 100;

Slider abc;



void setup() {

  size(800, 800);
  // background(255, 200);
  smooth();
  frameRate(60);

  cp5 = new ControlP5(this);
  // add a horizontal sliders, the value of this slider will be linked
  // to variable 'sliderValue' 
  cp5.addSlider("sliderValue")
    .setPosition(50, height-50)
      .setRange(0, 100)
        ;
}

void draw() {


  frb=sliderValue;
  println(sliderValue);


  pushMatrix();


  background(255, 1); //tried to set alpha very low. didnt work.
  // translate(1, 1);

  for (int i = 1; i<70; i++) {

    // Polar to Cartesian conversion
    float x = r * cos(theta);
    float y = r * sin(theta);
    //float x = (sin(frb));


    stroke(i/3, 3*i, 3, 30);
    noFill();
    //ellipse(pow(x, i/340) + width/2 -random(i*2), y + height/2, i, y);
    ellipse(width/2, height/2, x*i*frb/300, 5*y);

  //  translate(width/2, height/2);
    rotate(i*0.001);


    // Increment the angle
    theta += .05;
    t = t+1;
  }
  popMatrix();
}