getting mousReleased() to move rect further
in
Programming Questions
•
5 months ago
hey folks,
i am quite new to processing and i am having a problem with my new code. i added only the part of the code that i want to get working. i want the rect() to move out of the screen by itself by using mouseReleased(), after it came in and stopped (there you canrotate it by mouseX).
But it will only move once at a time when you click on the screen. i assume the action is not done repeatedly afte the mouse is clicked.
Any Ideas?
i am quite new to processing and i am having a problem with my new code. i added only the part of the code that i want to get working. i want the rect() to move out of the screen by itself by using mouseReleased(), after it came in and stopped (there you canrotate it by mouseX).
But it will only move once at a time when you click on the screen. i assume the action is not done repeatedly afte the mouse is clicked.
- int l;
int b;
//declare grid x-value
int transx1;
int g = 8;
void setup() {
size(900, 600);
}
void draw() {
background(175, 204, 231);
noStroke();
rectMode(CENTER);
l = 500; //Höhe
b = 90; //Breite
float a = PI*mouseX / width*2;
float c = PI*random(width/2 - 1, width/2 + 1) / width * 4;
//Black Stripe
fill(0);
//Moving In
translate(transx1,height/2);
//Stops at specific position
if(transx1<width/2-b){
transx1 = transx1 + g;
}
//Draw Rect and rotate by mouseX
rotate(a);
rect(0, 0, b, l);
}
void mouseReleased(){
transx1 = transx1 + g;
}
Any Ideas?
1