Photo 1: Coloring the Background.
To make this working, I changed the initial frame rate for slowing it down. I also adjusted the canvas' size and the colors (black and red accordingly). Finally, I defined the text as input type and its size.
Here's the code:
//Modified by: Aleksei Zhurankou
int num = 900; //setting frame ratenumber
float mx[] = new float[num]; //defining array to store mouse's x position
float my[] = new float[num]; //defining array to store mouse's y position
void setup() {
size(400, 320); //defining canvas size
fill(255, 0, 0); //setting paint color to red
}
void draw() {
background(0); //setting bg color to black
int which = frameCount % num;
mx[which] = mouseX; //assigning array values to mouse x position
my[which] = mouseY; //assigning array values to mouse y position
for (int i = 0; i < num; i++) { //assigning xy values with for-loop
int index = (which+1 + i) % num;
textSize(48); //setting text size
text("RED", mx[index], my[index]); //rendering current mouse position with text
}
}
No comments:
Post a Comment