I have begun learning about arrays. I sort of get it, but I have one problem understanding something..
I would like this effect (a circle follows the mouse position with interaction history):
int num = 50;
int[] x = new int[num];
int[] y = new int[num];
void setup() {
size(100, 100);
noStroke();
smooth();
fill(255, 102);
}
void draw() {
background(0);
// Shift the values to the right
for (int i = num - 1; i > 0; i--) {
x[i] = x[i-1];
y[i] = y[i-1];
}
// Add the new values to the beginning of the array
x[0] = mouseX;
y[0] = mouseY;
// Draw the circles
for (int i = 0; i < num; i++) {
ellipse(x[i], y[i], i / 2.0, i / 2.0);
}
}
But if I want the ellipse to instead be a star? A star is defined by a lot of points and not (x,y) like a circle.. How can I do this, I just cant seem to figure it out..
Here is a star, moveable, but missing the effect from the program at the top:
First of all thanks for a great community! I've used processing for two weeks at school and I've found sooo much help here:)
I am currently working on a project creating an interactive poster for my line of study!
The interactions have to be really simple so I hope you can help me :)
First of all, I have loaded the image of the poster into processing.
I need to make some rectangles with text in them when I move the mouse close to certain points on the screen. I know what I have to do, but I can't assemble it:
-Determine the specified area on the screen that should respond with interaction
-make a rect() that appears automatically when the mouse icon is moved into the area.
-apply text to the rect()
The second thing is that I've made a couple of mouse-click functions. Blue rectangles appear by left click. Green circles by right click. Erase by scroll click.
Now, I would like these shapes to slowly descend and exit the image, preferably with some sort of "feather falling towards the ground"-effect. This should happen as soon as you click the mouse and the shape appears.
Sorry for the long post, I am terrible at writing these things :)