I'm working for a foundation that raises awareness for accessibility in the internet. For a presentation, we want to offer a small workshop that simulates different disabilities/impairments to people. This is done via a website created especially for this presentation.
One of the demonstrated impairments is having a tremor, which means experiencing shaky, difficult-to-control hand movements. With this impairment, it's very difficult to move the mouse cursor exactly and to press the mouse button while the mouse is over a link. Both some old people and people with disease, e.g. Parkinson's, can suffer from tremor.
Now I'd like to somehow move the mouse cursor in an unpredictable way, so that it's very hard for people to click on a small button. Because JavaScript doesn't allow moving the mouse cursor directly, I'm looking for other ways to achieve this. I came up with the following ideas:
- Using a mouse driver / utility that simulates the mouse shaking.
- Hide the mouse cursor via CSS, place a GIF animation of a shaking mouse cursor at the place of the original cursor (with JavaScript), and then make the target link clickable only every few seconds for a second or so. This would at least give the feeling as if one always clicks at the wrong moment.
While the first idea would be pretty cool, I couldn't find a tool like this, whether for Mac nor for Windows. And I don't have any skills in programming such a thing myself.
The second idea seems a bit clumsy, but it would achieve the desired effect, I think.
Does anybody have another idea?
You can't expect anyone to be able to hold their hands perfectly steady, so one thing you can consider is,
My reasoning is (caveat, I am not an expert in ux or medicine) by making the click-able elements smaller, you creates a similar problem for most people that a person afflicted with Parkinson's disease would face with an everyday web site.
Here is a windows version of my xdotool script that uses AutoIt. This was my first ever AutoIt script, and it took only a couple of minutes to write, so I'm sure it can be improved. Just save with the extension .au3 and run it with AutoIt (Run Script x86).
Controls
Or use my compiled version from here.
The low-level parts of simulating the tremor are well answered by now. I will add something focusing on the kind of tremor to simulate:
Most answers implement a mouse cursor that is moving on a random path with some fixed maximal step width in X and Y direction.
This should work well enough for the use case of making it hard to hit a specific area like a button.
For the more general issue of simulating UI problems caused by a tremor from Parkinson's disease, it would be at least interesting to actually simulate the hand movements of this kind of tremor.
I suspect the random walk may not be a very good approximation.
It may be hard to get hold of real hand trace data of tremor movement of course, but there are certainly papers about analyzing this kind of tremor:
The paper Parametric Representation of Hand Movement in Parkinson’s Disease is about how to best plot 3D hand movement traces.
The paper is paywalled, but the preview on the top right, labeled "Look Inside >" on the book image, shows some interesting plots of different representations of hand trace data.
I did this as a joke once, on the Puppy Linux Forum and got the comment that:
Here is the shell script which requires xdotool
Name as parkinson_sim and run with optional argument for the time between tremors which can be 0.001 to 999.0.
I made the mistake of clicking on it myself instead of running it from the command line and quickly discovered how frustrating it must be. It took me several tries to get a terminal window open to kill it.
As you were thinking about doing it with a custom mouse driver I suppose a small program running on the PC would do either? If this is the case, here is a small snippet for C#, which infinitely moves the cursor randomly withing a range of plus minus 5px around the current cursor position. After each displacement the program waits 50 ms to 100 ms (not accurate!). The shakiness can be configured by adapting the values for the displacement and the pauses. I ran this in a console application and - depending on the values - it gave me quite a hard time stopping the program.
DIV
, CSS-hide the cursor usingcursor:none;
left
,top
) with jQ onmousemove
margin-left
andmargin-top
using asetTimeout
(to make the re-positioning smooth use CSS3transition
or do it with jQ.animate()
).Note: The script cannot know if the hand is still on the mouse ;)