Easing: Difference between revisions
No edit summary |
|||
Line 3: | Line 3: | ||
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 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. | ||
= 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 11: | ||
* "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 )'' | * "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 = | |||
Default values (when a function can use a parameter but it's not defined are): | Default values (when a function can use a parameter but it's not defined are): | ||
Line 40: | Line 38: | ||
<td></td><td></td><td></td><td></td> | <td></td><td></td><td></td><td></td> | ||
</tr> | </tr> | ||
<tr> | |||
<td>OutQuad</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>InOutQuad</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>OutInQuad</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>InElastic</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>OutElastic</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>InOutElastic</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>OutInElastic</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>InBack</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>OutBack</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>InOutBack</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>OutInBack</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>InBounce</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>OutBounce</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>InOutBounce</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>OutInBounce</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>SineCurve</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
<tr> | |||
<td>CosineCurve</td> | |||
<td></td> | |||
<td></td><td></td><td></td><td></td> | |||
</tr> | |||
</table> | </table> | ||
= Source = | |||
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 pictures of the easing functions are directly extracted from Qt documentation, © 2008-2010 Nokia Corporation and/or its subsidiaries. |
Revision as of 11:14, 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.
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
Default values (when a function can use a parameter but it's not defined are):
- fEasingPeriod: 0.3
- fEasingAmplitude : 1.
- fEasingOvershoot: 1.701
Easing function (strEasingType) | Function profile | Uses fEasingPeriod | Uses fEasingAmplitude | Uses fEasingOvershoot | Comments |
---|---|---|---|---|---|
Linear | |||||
InQuad | |||||
OutQuad | |||||
InOutQuad | |||||
OutInQuad | |||||
InElastic | |||||
OutElastic | |||||
InOutElastic | |||||
OutInElastic | |||||
InBack | |||||
OutBack | |||||
InOutBack | |||||
OutInBack | |||||
InBounce | |||||
OutBounce | |||||
InOutBounce | |||||
OutInBounce | |||||
SineCurve | |||||
CosineCurve |
Source
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 pictures of the easing functions are directly extracted from Qt documentation, © 2008-2010 Nokia Corporation and/or its subsidiaries.