Creating a motion path
in
Programming Questions
•
1 year ago
hey guys, im having troubles creating a motion path for my code. I am pretty new to processing and so far I have managed to make the animation follow the mouse, however I would like to create a motion path so the user can watch the animation rather than using their mouse. Any suggestions on how to do this?
Here is my code so far:
color col = color(66,168,237,200);
float lineLength = width/5;
float angle = 45;
float angleSpeed = 7;
void setup() {
size(1000, 414);
background(255);
smooth();
}
void draw() {
pushMatrix();
strokeWeight(0.3);
stroke(col);
translate(mouseX,mouseY);
rotate(radians(angle));
line(0, 0, lineLength, 0);
lineLength = random(width/4, height/2);
popMatrix();
angle += angleSpeed-10;
}
Cheers in advance
Here is my code so far:
color col = color(66,168,237,200);
float lineLength = width/5;
float angle = 45;
float angleSpeed = 7;
void setup() {
size(1000, 414);
background(255);
smooth();
}
void draw() {
pushMatrix();
strokeWeight(0.3);
stroke(col);
translate(mouseX,mouseY);
rotate(radians(angle));
line(0, 0, lineLength, 0);
lineLength = random(width/4, height/2);
popMatrix();
angle += angleSpeed-10;
}
Cheers in advance
1