Easing: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "Easing functions describe functions that control the way an interpolation between 0 and 1 is done. The most basic one, linear, is just a linear interpolation at constant speed. ...")
 
No edit summary
Line 4: Line 4:


The naming conventions of the functions below, available in [[moveObject]], [[interpolateBetween]], or [[getEasingValue]] as been extracted from http://doc.qt.nokia.com/latest/qeasingcurve.html. Only a subset of those functions is available in MTA since some of them are a bit redundant (only the profile or acceleration/deceleration changes).
The naming conventions of the functions below, available in [[moveObject]], [[interpolateBetween]], or [[getEasingValue]] as been extracted from http://doc.qt.nokia.com/latest/qeasingcurve.html. Only a subset of those functions is available in MTA since some of them are a bit redundant (only the profile or acceleration/deceleration changes).
== Preliminary note ==


In the functions using easing, there are usually 3 optional parameters. Most functions don't need them at all, the ones needing one or more parameters are listed in the table below. When providing optional parameters, all the parameters before a given parameter must be filled, even if the easing function you intend to use doesn't require such a parameter. In this case, simply use 0 for the parameters you don't need.
In the functions using easing, there are usually 3 optional parameters. Most functions don't need them at all, the ones needing one or more parameters are listed in the table below. When providing optional parameters, all the parameters before a given parameter must be filled, even if the easing function you intend to use doesn't require such a parameter. In this case, simply use 0 for the parameters you don't need.
Line 13: Line 15:
== Easing functions ==
== Easing functions ==


(table to come)
<table border="1" class="unnamed1">
<tr>
<th>Easing function (strEasingType)</th>
<th>Function profile</th>
<th>Can use fEasingPeriod (default 0.3)</th>
<th>Can use fEasingAmplitude (default 1.0)</th>
<th>Can use fEasingOvershoot(default 1.7015)</th>
<th>Comments</th>
</tr>
 
<tr>
<td>Linear</td>
<td></td>
<td></td><td></td><td></td><td></td>
</tr>
<tr>
<td>InQuad</td>
<td></td>
<td></td><td></td><td></td><td></td>
</tr>
</table>

Revision as of 10:54, 17 December 2010

Easing functions describe functions that control the way an interpolation between 0 and 1 is done.

The most basic one, linear, is just a linear interpolation at constant speed. Other more advanced easing functions can have acceleration at the beginning, the end or both, or deceleration , or even bouncing or elastic effects.

The naming conventions of the functions below, available in moveObject, interpolateBetween, or getEasingValue as been extracted from http://doc.qt.nokia.com/latest/qeasingcurve.html. Only a subset of those functions is available in MTA since some of them are a bit redundant (only the profile or acceleration/deceleration changes).

Preliminary note

In the functions using easing, there are usually 3 optional parameters. Most functions don't need them at all, the ones needing one or more parameters are listed in the table below. When providing optional parameters, all the parameters before a given parameter must be filled, even if the easing function you intend to use doesn't require such a parameter. In this case, simply use 0 for the parameters you don't need. Examples:

  • "Linear" can used simply with getEasingValue( fProgress, "Linear" )
  • "OutElastic" can define fEasingPeriod and fEasingAmplitude with getEasingValue( fProgress, "OutElastic", 0.3, 1.0 )
  • "InBack" can define fEasingOvershoot, but since it comes after fEasingPeriod and fEasingAmplitude in the order of parameters, 0 must be used for the others with getEasingValue( fProgress, "InBack", 0, 0, 1.7015 )

Easing functions

Easing function (strEasingType) Function profile Can use fEasingPeriod (default 0.3) Can use fEasingAmplitude (default 1.0) Can use fEasingOvershoot(default 1.7015) Comments
Linear
InQuad