Knob / slider animation: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (Bold subject, category)
No edit summary
Line 9: Line 9:
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 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.


If you need different behaviours for increase vs decrease, add bindings to the <cw> and <ccw> 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.


A <release> binding is available which fires when the button is released, for spring-loaded knobs (commonly used for engine starters) which return to a position after selection.
A <release> binding is available which fires when the button is released, for spring-loaded knobs (commonly used for engine starters) which return to a position after selection.
Line 19: Line 19:
If the above mechanism is too simple, or you wish shifted mode to do something different to unshifted mode, you can specify explicit bindings instead. As soon as you specify an explicit shifted binding, the default 'repeat' behaviour is skipped. Examples of alternate shifted mode would be many MCP or GPS knobs, where pushed/pulled mode might change a totally different setting, eg fractional vs integer part of a radio frequency, or bank limit instead of selected heading.
If the above mechanism is too simple, or you wish shifted mode to do something different to unshifted mode, you can specify explicit bindings instead. As soon as you specify an explicit shifted binding, the default 'repeat' behaviour is skipped. Examples of alternate shifted mode would be many MCP or GPS knobs, where pushed/pulled mode might change a totally different setting, eg fractional vs integer part of a radio frequency, or bank limit instead of selected heading.


The group names are <shift-action>, <shift-cw> and <shift-ccw>
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.
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.
Line 49: Line 49:
             </binding>
             </binding>
         </action>
         </action>
         <!-- explicit clockwise binding, action binding still runs too -->
         <!-- explicit increase binding, action binding still runs too -->
         <cw>
         <increase>
             <binding>
             <binding>
                 <command>nasal</command>
                 <command>nasal</command>
                 <script>debug.dump('was increased', cmdarg().getNode('offset').getValue());</script>
                 <script>debug.dump('was increased', cmdarg().getNode('offset').getValue());</script>
           </binding>
           </binding>
         </cw>
         </increase>
         <!-- explicit anit-clockwise binding, action binding still runs too -->
         <!-- explicit decrease binding, action binding still runs too -->
         <ccw>
         <decrease>
             <binding>....</binding>
             <binding>....</binding>
         </ccw>
         </decrease>
     </animation>
     </animation>
  </PropertyList>
  </PropertyList>
580

edits

Navigation menu