I'm interested in possibly working with a Processing artist that would like to collaborate with me. I make computer music and I have a few abstract sound compositions that I would like to mix with some Processing visuals. I have a few ideas for the aesthetic look of the visuals and I think it would be really interesting to see the output. I have been learning Processing on and off but my skills aren't there yet. So, if anyone has some time for an art collaboration, send me a message.
My first attempt at converting a procedural program to OOP is not behaving as it should. I can't pinpoint what's wrong with the code, but I suspect the class I wrote is at fault somewhere. Is it the way I called/setup the mouseClicked function?
Procedural version.
float x = 40;
float y = 40;
int bxW = 60;
int bxH = 60;
boolean rectClicked = false;
float moveX = 2;
int countClick = 0;
///////////////////////////////
void setup() {
size(700, 600);
smooth();
noStroke();
}
///////////////////////////////////////
void draw() {
background(255);
box1();
emptyRect();
}////////////////////////////// end draw
//----------- functions -----------
/////////////////////////////////////////
void box1 () {
// draw the square
fill(#7178E5);
noStroke();
rect(x, y, bxW, bxH);
if (rectClicked) {
countClick = 1;
x += moveX;
if (x>= 400) {
x = 400;
moveX = - moveX;
}
if (x<=40) {
x = 40;
moveX = - moveX;
}
}
else {
countClick = 0;
x = 40;
}
}
////////////////////////////////
void emptyRect() {
//empty rect
stroke(#3C3D40);
fill(255, 15);
rect(40, 40, 60, 60);
}
//////////////////////////////////
void mouseClicked() {
box1MouseClick();
}
///////- box1 mouse click functions ///////////
void box1MouseClick() {
if ((mouseX>42) && (mouseX<=99) && (mouseY >44) && (mouseY<99)) {
How would I go about making mouseClicked only work when clicking on certain rects/objects. I have one square right now that works when the mouse gets clicked, but later on I would like to add more squares and have each one only move when the mouse gets clicked within that square. I'm thinking functions, but not sure how to implement this. If there is a cruder way to accomplish this without functions, that's ok too.
I've been trying to figure out how to make this sine wave animation go backwards smoothly after it hits the bottom of the processing window. I've tried a while loop that decreases 'y' by 1 when 'y' is greater than height, but it just gets frozen. I basically want the animation to go up/down smoothly. How can I make the animation go in reverse when it reaches the bottom and vice versa?