We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, is there a piece of code for this? I've been trying to search the interwebz but found nothing.
not really...
you have to make it yourself
e.g.
void mouseMoved() { // gets called automatically lastTimeMouseMoved = millis(); }
before setup()
setup()
int lastTimeMouseMoved = -1;
then in draw() check how much time has past since the mouse moved the last time using
draw()
howmuchtimehaspastsincethemousemoved = millis() - lastTimeMouseMoved ;
ok thanks
This is another way to do it. Processing remembers that previous mouse position. You can use this inside the draw () function.
if (mouseX == pmouseX && mouseY == pmouseY){ // mouse has not moved }
thanks...
looks simpler...
not sure if it'll work when we want to monitor a length of 0.5 secs though
Where did the 0.5 seconds come from? There is no mention of time in the question?
never mind
just an example
sry
;-)
No problem I just got confused, if you wanted to know how long the mouse was stationary you would need to use mills() :)
ah I see how you did it quark, ty.
mouseMoved() gets called automatically when the mouse moves
Answers
not really...
you have to make it yourself
e.g.
before
setup()
then in
draw()
check how much time has past since the mouse moved the last time usingok thanks
This is another way to do it. Processing remembers that previous mouse position. You can use this inside the draw () function.
thanks...
looks simpler...
not sure if it'll work when we want to monitor a length of 0.5 secs though
Where did the 0.5 seconds come from? There is no mention of time in the question?
never mind
just an example
sry
;-)
No problem I just got confused, if you wanted to know how long the mouse was stationary you would need to use mills() :)
ah I see how you did it quark, ty.
mouseMoved() gets called automatically when the mouse moves