D
Dr J R Stockton
I can now revolve the Universe by using my mouse :
see <http://www.merlyn.demon.co.uk/astron-5.htm#FS>.
But all I do is to turn it by +1 or -1 degree at a time, according to
whether the mouse moves to the right or to the left :
Rag.onmousedown = function (e) { Doon = true }
Rag.onmouseup = function (e) { Doon = false }
Rag.onmousemove = function (e) { if (!Doon) return
e = e || window.event
var X = e.clientX
var Q = document.forms[0].Revolve
Q.value = +Q.value + (XXX < X ? +1 : -1)
Draw()
XXX = X }
(tested in FF 3.0.15 only)
I have not yet been able to discover how to convert (cross-browser)
e.clientX and e.clientY (or other) values to X and Y co-ordinates with
respect to the centre of the canvas (which is of known size, so the
corner will do).
With that it should be easy enough to make the Universe rotate as if the
mouse, when down, were holding on to a spoke of the circle but able to
slide along it.
Ant suggestions? Working ones?
see <http://www.merlyn.demon.co.uk/astron-5.htm#FS>.
But all I do is to turn it by +1 or -1 degree at a time, according to
whether the mouse moves to the right or to the left :
Rag.onmousedown = function (e) { Doon = true }
Rag.onmouseup = function (e) { Doon = false }
Rag.onmousemove = function (e) { if (!Doon) return
e = e || window.event
var X = e.clientX
var Q = document.forms[0].Revolve
Q.value = +Q.value + (XXX < X ? +1 : -1)
Draw()
XXX = X }
(tested in FF 3.0.15 only)
I have not yet been able to discover how to convert (cross-browser)
e.clientX and e.clientY (or other) values to X and Y co-ordinates with
respect to the centre of the canvas (which is of known size, so the
corner will do).
With that it should be easy enough to make the Universe rotate as if the
mouse, when down, were holding on to a spoke of the circle but able to
slide along it.
Ant suggestions? Working ones?