JavaRanch » Java Forums »
Java »
Applets
| Author |
Circular motion applet
|
richard dela cruz
Greenhorn
Joined: Oct 03, 2012
Posts: 1
|
|
can anyone tell me an easy way to make a single dot move in circular motion? so far... i've only done these...
|
 |
Jelle Klap
Bartender
Joined: Mar 10, 2008
Posts: 1407
|
|
Think about how you would normally find the X and Y coördinates of a point on the unit circle.
Then think about how you could use that same logic to implement a dot that moves in a circular motion.
|
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4163
|
|
Don't use Thread#sleep(...) in a painting method override or indeed in any code that runs on the EDT.
Use a javax.swing.Timer for animation. Change the coordinates and call repaint().
|
luck, db
There are no new questions, but there may be new answers.
|
 |
 |
|
|
subject: Circular motion applet
|
|
|
|