We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm new to the forum!
I haven't been using Processing for very long, so naturally I am stuck :P I am looking to animate a small project of mine, but I am at a loss of what to do. I am using Java. I have the image that I am trying to animate uploaded here: http://tinypic.com/r/spahhj/8 or [IMG]http://i57.tinypic.com/spahhj.png[/IMG]. All I'm trying to do is to get the straight lines going down to move down slowly, then to hit the curve and then end up at the circle, as in the diagram. I'm able to get a few of the straight lines to appear only, and to get them to go diagonally but that's about it. I don't know how to create the circle or the curved line.
Here's my code so far:
int moveLine = 20;
float lineAngleX = 20;
float lineAngleY = 380;
void setup() {
size(400, 400);
}
void draw() {
line(20,20,20,moveLine);
if(moveLine<=380){
moveLine++;
} {
line(50,20,50,moveLine);
if(moveLine<=385) {
moveLine++;
}
if(moveLine>=380){
line(20,380,lineAngleX,lineAngleY);
lineAngleX++;
lineAngleY--;}
}
}
Not much... If anyone could help me by sending me code of a full working model if they'd be so kind, and I could look through it to see what you did to learn about it, that would be great. I know it's a lot to ask but I'm desperate! Thanks.
Answers
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
My code is formatted correctly but for some reason when I pressed 'Post' it changed it down to this weird format.
Here's what it looks like: http://tinypic.com/r/sz8vaw/8
modified
probably you need 2 empty lines before and after the code when posting
look into the reference for details on ellipse (for circle) and arc (for the curve) pls
https://www.processing.org/reference/
the actual reflection is not easy I guess
but I made a curve for you using curve(). look into curvePoint() to move on from here.
tasks:
detect when line is hitting the curve (easy)
calculate the new angle for the line from here (hard)
keep drawing the line in the new direction
;-)
Aahhhh! Thank you very much for all your help!
great!