Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

How to control size of drawn shape with controlP5

$
0
0

Hello, I'm new to the Processing and would love to know how to change width of the ellipse after it has been already drawn with a mouse, using slider from cp5. This is my current code which changes width of a ellipse before its been drawn with a mouse.

import controlP5.*;
ControlP5 cp5;

int slider = 100;

void setup(){
  size(800,800);
  cp5 = new ControlP5(this);
  cp5.addSlider("slider").setPosition(400,400).setRange(0,255);

}

void draw(){
  int w=slider;
  if(mousePressed) ellipse(mouseX, mouseY, w, 5);
}

Any help is appreciated. Thank you!


Viewing all articles
Browse latest Browse all 2896

Trending Articles