Knob / slider animation: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 1: Line 1:
The new (in 2.11) '''knob animation''' is a helper to reduce repetition in XML files, and provide a separation point for behaviour versus user interface. The idea is to specify a single animation element representing the knob or dial, with bindings for various actions, and allow the GUI to decide which user interactions map to those behaviours. In particular the mapping could be adjusted by platform (Mac vs Linux), device type (laptop or not) or a GUI preference. All knobs using the animation would hence have standard user-interaction across all aircraft, which is not the case at present.
The new (in 2.11) '''knob animation''' and '''slider animation''' are helpers to reduce repetition in XML files, and provide a separation point for behaviour versus user interface. The idea is to specify a single animation element representing the knob, dial or slider, with bindings for various actions, and allow the GUI to decide which user interactions map to those behaviours. In particular the mapping could be adjusted by platform (Mac vs Linux), device type (laptop, trackpad, trackball or touch-screen) or a GUI preference. All objects using the animation would hence have standard user-interaction across all aircraft, which is not the case at present.


=== Rotate animation ===
=== Rotate / Translate animation ===


The core animation values are identical to the standard 'rotate' animation. In the future, the values might be used to provide drag-based mouse interaction, by tracking movements relative to the rotation axis. This is why the animation data is included in the same animation element - otherwise it could be kept separate with no consequences.
The core animation values are identical to the standard 'rotate' and 'translate' animations. They can be omitted without problem if you want to keep the animations separate for some reason, e.g. different pick objects to animated objects in the model.


=== Binding Actions ===
=== Binding Actions ===


Using the <action> group, a single set of bindings are run for movement of the knob in either direction. An 'offset' property is exposed, with a value of either 1 or -1. For many common cases, such as a property-adjust command, this will work for both directions of the knob, with suitable scale and min/max limits.
Using the <action> group, a single set of bindings are run for movement of the knob/slider in either direction. An 'offset' property is exposed, with a value of either 1 or -1. For many common cases, such as a property-adjust command, this will work for both directions of movement, with suitable scale and min/max limits.


If you need different behaviours for increase vs decrease, add bindings to the <increase> and <decrease> groups instead. Note both systems can be used in parallel - all the bindings fire.
If you need different behaviours for increase vs decrease, add bindings to the <increase> and <decrease> groups instead. Note both systems can be used in parallel - all the bindings fire.
Line 21: Line 21:
The group names are <shift-action>, <shift-increase> and <shift-decrease>
The group names are <shift-action>, <shift-increase> and <shift-decrease>


Note the animation is in active development, expect the API to evolve rapidly, However, it will only improve with use and feedback, so if you try it and don't like something, please say.
=== Dragging ===
 
Dragging the object generates value changes, based on the direction of mouse movement. The mapping from pixel movement to offset values is controlled by the <drag-scale> property, which divides the pixel movement. Hence, smaller values mean faster movement (harder to hit a precise value accurately) and larger values mean slower movement (easier to hit a particular value, but more mouse movement needed). The default value is 10px to cause a change.
 
By default the drag direction is left-right (since most people have better mobility in that direction, and screens are wider than tall), but each slider or knob can over-ride this, eg for throttle or mixture controls built-into a panel, up-down movement will feel more natural.  


== Examples ==
== Examples ==
580

edits

Navigation menu