Schroedingers-Hat / jsphys

Libraries for physics simulation on javascript canvas
GNU Affero General Public License v3.0
11 stars 1 forks source link

Zoom/accelerate. Managable interface #67

Open Schroedingers-Hat opened 13 years ago

Schroedingers-Hat commented 13 years ago

Now that I've got most of the c's in (i'm sure I still missed a few), it would be nice to be able to zoom WAAAY out (and in). Perhaps make the slider logarithmic if it isn't? This will help verify that everything behaves the same by changing c and the scale of objects by the same amount. The current way I set acceleration was intended to be a quick hack so I could see what is going on, it's not really a good way of controlling things, so we should think about controls. Do we want to keep some controls keyboard only? Make everything keyboard or mouse, or make some/all things mouse only? Another way of selecting acceleration rates is wise, given no better ideas I propose that the number keys change the rate of acceleration. Alternatively the F key could be used to toggle Fast (shift F for slow?) and just have a few different accelerations.

Other ideas. Many of these will make performing experiments easier: Mouse control/field input to set an exact acceleration, velocity relative to another object Set acceleration per proper time somehow (rather than per frame). This will make things far less twitchy on faster computers. Translate by given amount. Possibly click-drag on the crosshairs/ship to move, then release and the new frame is calculated, or enter distance in a text field. Modal mouse control with toggles/buttons (ie. click teleport, click object) Thoughts?

capnrefsmmat commented 13 years ago

Now that I've got most of the c's in (i'm sure I still missed a few), it would be nice to be able to zoom WAAAY out (and in). Perhaps make the slider logarithmic if it isn't?

The slider works in powers of two like the +/- buttons do; check out interface.js if you want to see how it works. The slider is just bounded to conservative values at the moment; you can change that. Slider docs and examples are here.

As for the rest, I'll have to give this some thought. I'll get back to you.

Schroedingers-Hat commented 12 years ago

Thought: Could the slider boundaries change when you move them? Will explain by example let's say boundary is at 10/-10, slider is at 0 Say you move the slider 50% of the way from the middle to the edge, When mouse is released, the boundary is increased by 50% to 15. The slider is then moved (automatically) back to 50 * 10/15 = 33% of the way from the middle to the edge.

Can't think of how to decide what to do going the other way.

Another option is make the slider a lever/spring type of thing that represents rate of change rather than absolute. So zoom slider would normally be in the middle. Far ends represent doubling every second, near the middle represents slower change. When you release it, it snaps back to the middle.

capnrefsmmat commented 12 years ago

Hypothetically, yes. Seems like it'd be fairly confusing, though.

One option would be to let demos specify a "base" zoom level, and have the slider be logarithmic around that base. Hence a reeeeeeallly huge demo could specify a wide-angle view, and the user would be able to move around in that range. A small demo would have a narrow view. The slider would behave as it does now, but the range would differ per demo.

Schroedingers-Hat commented 12 years ago

The time scale was the main one that was twitchy and I was hoping for a factor of a few thousand available for a ''realistic journey to another star" type thing.

Another interface for similar things I've seen is a string of x1.5 x2 x5 x10 x20 x50 buttons

One more thought occurs. That fancy site you did put me in mind of it (I don't suppose you'd have some relevant code lying around?) instead of a slider, use a wheel metaphor. Have a grab-able area which you can pull to the side (or if feeling fancy right around), and a number (or dial -- steampunk) displayed below. This can be completely logarithmic with a toggle for reverse, or it could be made to go linear for a short section (say between 2 and -2) and then back to exponential.

capnrefsmmat commented 12 years ago

Unfortunately the fancy rotating thingy I did was tied directly to scroll, rather than being adjustable by mouse drag.

If all else fails, we could make the time speed slider extend the width of the caption window, and expand its range greatly. The +/- buttons will still be available for fine control.

Schroedingers-Hat commented 12 years ago

I'm pretty sure 'arrr, you be dragging a thing' (or at least, 'this is where you clicked' 'this is where the mouse is now' is fairly standard these days, so it's more a matter of animating a spinny thing. If all else fails (read IE) it can be inside the canvas.