We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Please help me!
I want to know how i can adjust the mouseButton == CENTER, when you press this button(CENTER MOUSE BUTTON), both lines need to appear, so the LEFT & RIGHT line need to appear together...??
Does anyone know how to do this? The code is below....
PVector curPoint ; PVector prevPoint ; float teller = 0;
void setup() { size(1920,1080); background(255); strokeWeight(1); curPoint = new PVector(int(random(width)), int(random(height))); prevPoint = curPoint; }
void draw() { if (mousePressed && (mouseButton == RIGHT)) { float x = lerp(prevPoint.x, curPoint.x, teller); float y = lerp(prevPoint.y, curPoint.y, teller); colorMode(HSB, 360,100,100); stroke(134, 100, map(teller, 0,1, 0,200)); line(prevPoint.x, prevPoint.y, x,y);
if(teller < 1){
teller = teller + .0075;
}
if(teller > .98){
ellipse(curPoint.x, curPoint.y,10,10);
}}
if (mousePressed && (mouseButton == LEFT)) {
float x = lerp(prevPoint.x, curPoint.x, teller);
float y = lerp(prevPoint.y, curPoint.y, teller);
colorMode(HSB, 360,100,100);
stroke(0, 100, map(teller, 0,1, 0,200));
line(prevPoint.x, prevPoint.y, x,y);
if(teller < 1){
teller = teller + .0075;
}
if(teller > .98){
ellipse(curPoint.x, curPoint.y,10,10);
}}
if (mousePressed && (mouseButton == CENTER)) {
float x = lerp(prevPoint.x, curPoint.x, teller);
float y = lerp(prevPoint.y, curPoint.y, teller);
colorMode(HSB, 360,100,100);
stroke(0, 100, map(teller, 0,1, 0,200));
line(prevPoint.x, prevPoint.y, x,y);
if(teller < 1){
teller = teller + .0075;
}
if(teller > .98){
ellipse(curPoint.x, curPoint.y,10,10);
}}
}
void mousePressed() { prevPoint = curPoint; curPoint = new PVector(int(random(width)), int(random(height))); teller = 0.0; }
Answers
Check the reference here :https://processing.org/reference/mouseButton.html
Here is a sample code below.
Kf