Results 1 to 2 of 2
Thread: How to Measure Speed in Java?
- 04-22-2012, 12:56 AM #1
How to Measure Speed in Java?
Greetings, everyone. Before I explain the title, I just want to introduce what I'm trying to do:
I have a series of images. Mostly a body with two arms. It responds to the movement of the mouse. When the mouse moves, I want the arms to rotate backwards, as if dealing with a lot of air resistance. I have no problems with the rotation, the only issue is I want the arms to flail back more and more the faster the mouse is moving.. But then, how do I measure the speed of the mouse? Is there a way to measure how much pixels the mouse is covering when it moves over a certain amount of time? Or is there another method to get different results of an action to occur when dealing with various speeds of MouseMotion movement?
I hope this isn't too vague. If you need any clarifications in order to help me out with this issue, feel free to let me know
- 04-22-2012, 03:11 AM #2
Re: How to Measure Speed in Java?
The mouse's position and the time the mouse was at that position should allow you to compute a speed:
change in position/change in time.
The System class has a method that returns the current system time.If you don't understand my response, don't ignore it, ask a question.
- By Masherbrum in forum New To JavaReplies: 0Last Post: 04-06-2012, 04:11 AM
- By Vinn in forum New To JavaReplies: 3Last Post: 03-06-2012, 09:27 PM
- By Les Paul in forum New To JavaReplies: 1Last Post: 10-15-2011, 08:17 PM
- By devday in forum NetworkingReplies: 0Last Post: 01-04-2010, 11:40 AM
- By islamfunny in forum CLDC and MIDPReplies: 0Last Post: 09-25-2008, 04:27 PM