Newton's Cradle Programming Help!
in
Programming Questions
•
1 year ago
Hi, I started processing a little while ago and wanted to know if any one can help in learning how to move the Newton's Cradle program that I am trying to write.
What I have so far is just drawing. Basically I am trying to get the ball on the left to move up and hit the other balls and the right goes up, and a continuation.
void setup() {
size (800, 300);
smooth();
noStroke();
}
void draw() {
background(255);
fill(59,54,54);
rect(195, 0, 5, 150) ;
rect(320, 0, 5, 150);
rect(445, 0, 5, 150);
rect(570, 0, 5, 150);
fill(0);
ellipse(195, 210, 125, 125);
ellipse(320, 210, 125, 125);
ellipse(445, 210, 125, 125);
ellipse(570, 210, 125, 125);
}
Thank You!
What I have so far is just drawing. Basically I am trying to get the ball on the left to move up and hit the other balls and the right goes up, and a continuation.
void setup() {
size (800, 300);
smooth();
noStroke();
}
void draw() {
background(255);
fill(59,54,54);
rect(195, 0, 5, 150) ;
rect(320, 0, 5, 150);
rect(445, 0, 5, 150);
rect(570, 0, 5, 150);
fill(0);
ellipse(195, 210, 125, 125);
ellipse(320, 210, 125, 125);
ellipse(445, 210, 125, 125);
ellipse(570, 210, 125, 125);
}
Thank You!
1