Bindings: Difference between revisions

Jump to navigation Jump to search
→‎property-interpolate: complete documentation, use syntaxhighlighting
(→‎property-multiply: property-interpolate)
(→‎property-interpolate: complete documentation, use syntaxhighlighting)
Line 59: Line 59:


=== property-interpolate ===
=== property-interpolate ===
Interpolates to a value with a given rate of change.
Interpolates to a value with a given rate of change (per second).
    <binding>
<syntaxhighlight lang="xml">
        <command>property-interpolate</command>
<binding>
        <property>/controls/flight/aileron-trim</property>
<command>property-interpolate</command>
        <value type="double">0</value>
<property>/controls/flight/aileron-trim</property>
        <rate>0.5</rate><!-- 2 seconds to 0 from 1 or -1 -->
<value type="double">0</value>
    </binding>
<rate>0.5</rate><!-- 2 seconds to 0 from 1 or -1 -->
</binding>
</syntaxhighlight>
 
Instead of using <rate>, one could use <time>, to specify the time (in seconds) it takes to go to the new value, independent of the current value.
<syntaxhighlight lang="xml">
<binding>
<command>property-interpolate</command>
<property>/controls/flight/aileron-trim</property>
<value type="double">0</value>
<time>2</time><!-- 2 seconds to 0 from 1, 0.5, -1 etc. -->
</binding>
</syntaxhighlight>


You can also interpolate to a value given by a property.
You can also interpolate to a value given by a property.
    <binding>
<syntaxhighlight lang="xml">
        <command>property-interpolate</command>
<binding>
        <property>/controls/flight/aileron-trim</property>
<command>property-interpolate</command>
        <property>/controls/flight/default-aileron-trim</property><!-- the value to interpolate to -->
<property>/controls/flight/aileron-trim</property>
        <rate>0.5</rate><!-- 2 seconds to 0 from 1 or -1 -->
<property>/controls/flight/default-aileron-trim</property><!-- the value to interpolate to, is 0 -->
    </binding>
<rate>0.5</rate><!-- 2 seconds to 0 from 1 or -1 -->
 
</binding>
</syntaxhighlight>


=== property-multiply ===
=== property-multiply ===

Navigation menu