We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I just need a sample code to help me with making the scroll wheel change the size of my ellipse as I scroll up it enlarges and as I scroll down it goes smaller. Anything helps. Thanks!
import controlP5.*;
ControlP5 cp5;
int c = color(100);
void setup() {
size(800, 800);
smooth();
cp5 = new ControlP5( this );
cp5.addColorWheel("c", 596, 3, 200 ).setRGB(color(128, 0, 255));
noStroke();
background(0, 255, 255);
//Below is the drawing area black border.
stroke(0);
strokeWeight(8);
rect(10, 220, 780, 570);
fill(255);
PFont font;
font = loadFont("UrbanClass-10.vlw");
//Instructions are below in this code.
String s = "Your objective is to complete the following drawing in 2 minutes. If you don't finish then restart and try again! This is only a beta.";
fill(50);
text(s, 10, 10, 400, 100); // Text wraps within text box
//Below is "Draw Here!" inside of rect.
textFont(font, 12);
fill(0);
text("Draw Here!", 360, 240);
}
void draw() {
frameRate(800);
println(mouseX + " : " + mouseY);
if ( mouseX < 790 && mouseY > 10) {
//Draw normal
if (mousePressed && (mouseButton == LEFT)) {
ellipse(mouseX, mouseY, 5, 5);
fill(c);
noStroke();
//Eraser
} else if (mousePressed && (mouseButton == RIGHT)) {
ellipse(mouseX, mouseY, 10, 10);
noStroke();
fill(255);
}
}
}
void mouseWheel(MouseEvent event) {
float e = event.getCount();
println(e);
ellipse(mouseX, mouseY, 10, 10);
fill(c);
noStroke();
}
Answers
https://forum.Processing.org/two/discussion/598/mousewheel-syntax-question-solved
https://forum.Processing.org/two/discussion/5618/crop-image
It's not possible to draw things outside of a void draw(){ } function.
I made a new int brushSize that the ellipse() uses to make each new circle.
Thanks for the help. Do you mind if I use some of this code to aid me in my code?
Well it is your program, I just knocked the dust off. Sure, you can use your own idea! :)
I am a beginner so this really helps. Thanks, man! Really appreciate the help.
No problem. Keep workin' at it! :-?