Table Of Contents

Previous topic

QElapsedTimer

Next topic

QDateTime

QEasingCurve

Inheritance diagram of QEasingCurve

Note

This class was introduced in Qt 4.6

Synopsis

Functions

Detailed Description

The PySide.QtCore.QEasingCurve class provides easing curves for controlling animation.

Easing curves describe a function that controls how the speed of the interpolation between 0 and 1 should be. Easing curves allow transitions from one value to another to appear more natural than a simple constant speed would allow. The PySide.QtCore.QEasingCurve class is usually used in conjunction with the PySide.QtCore.QVariantAnimation and PySide.QtCore.QPropertyAnimation classes but can be used on its own. It is usually used to accelerate the interpolation from zero velocity (ease in) or decelerate to zero velocity (ease out). Ease in and ease out can also be combined in the same easing curve.

To calculate the speed of the interpolation, the easing curve provides the function PySide.QtCore.QEasingCurve.valueForProgress() , where the progress argument specifies the progress of the interpolation: 0 is the start value of the interpolation, 1 is the end value of the interpolation. The returned value is the effective progress of the interpolation. If the returned value is the same as the input value for all input values the easing curve is a linear curve. This is the default behaviour.

For example,

QEasingCurve easing(QEasingCurve::InOutQuad);

for(qreal t = 0.0; t < 1.0; t+=0.1)
    qWarning() << "Effective progress" << t << " is
               << easing.valueForProgress(t);

will print the effective progress of the interpolation between 0 and 1.

When using a PySide.QtCore.QPropertyAnimation , the associated easing curve will be used to control the progress of the interpolation between startValue and endValue:

QPropertyAnimation animation;
animation.setStartValue(0);
animation.setEndValue(1000);
animation.setDuration(1000);
animation.setEasingCurve(QEasingCurve::InOutQuad);

The ability to set an amplitude, overshoot, or period depends on the PySide.QtCore.QEasingCurve type. Amplitude access is available to curves that behave as springs such as elastic and bounce curves. Changing the amplitude changes the height of the curve. Period access is only available to elastic curves and setting a higher period slows the rate of bounce. Only curves that have “boomerang” behaviors such as the InBack , OutBack , InOutBack , and OutInBack have overshoot settings. These curves will interpolate beyond the end points and return to the end point, acting similar to a boomerang.

The Easing Curves Example contains samples of PySide.QtCore.QEasingCurve types and lets you change the curve settings.

class PySide.QtCore.QEasingCurve([type=Linear])
class PySide.QtCore.QEasingCurve(other)
Parameters:

Constructs an easing curve of the given type .

Construct a copy of other .

PySide.QtCore.QEasingCurve.Type

The type of easing curve.

Constant Description
QEasingCurve.Linear PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-linear.png..raw::html<br/>Easingcurveforalinear(t)function:velocityisconstant.
QEasingCurve.InQuad PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inquad.png..raw::html<br/>Easingcurveforaquadratic(t^2)function:acceleratingfromzerovelocity.
QEasingCurve.OutQuad PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outquad.png..raw::html<br/>Easingcurveforaquadratic(t^2)function:deceleratingtozerovelocity.
QEasingCurve.InOutQuad PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutquad.png..raw::html<br/>Easingcurveforaquadratic(t^2)function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInQuad PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinquad.png..raw::html<br/>Easingcurveforaquadratic(t^2)function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InCubic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-incubic.png..raw::html<br/>Easingcurveforacubic(t^3)function:acceleratingfromzerovelocity.
QEasingCurve.OutCubic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outcubic.png..raw::html<br/>Easingcurveforacubic(t^3)function:deceleratingtozerovelocity.
QEasingCurve.InOutCubic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutcubic.png..raw::html<br/>Easingcurveforacubic(t^3)function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInCubic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outincubic.png..raw::html<br/>Easingcurveforacubic(t^3)function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InQuart PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inquart.png..raw::html<br/>Easingcurveforaquartic(t^4)function:acceleratingfromzerovelocity.
QEasingCurve.OutQuart PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outquart.png..raw::html<br/>Easingcurveforaquartic(t^4)function:deceleratingtozerovelocity.
QEasingCurve.InOutQuart PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutquart.png..raw::html<br/>Easingcurveforaquartic(t^4)function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInQuart PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinquart.png..raw::html<br/>Easingcurveforaquartic(t^4)function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InQuint PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inquint.png..raw::html<br/>Easingcurveforaquintic(t^5)easingin:acceleratingfromzerovelocity.
QEasingCurve.OutQuint PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outquint.png..raw::html<br/>Easingcurveforaquintic(t^5)function:deceleratingtozerovelocity.
QEasingCurve.InOutQuint PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutquint.png..raw::html<br/>Easingcurveforaquintic(t^5)function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInQuint PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinquint.png..raw::html<br/>Easingcurveforaquintic(t^5)function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InSine PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-insine.png..raw::html<br/>Easingcurveforasinusoidal(sin(t))function:acceleratingfromzerovelocity.
QEasingCurve.OutSine PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outsine.png..raw::html<br/>Easingcurveforasinusoidal(sin(t))function:deceleratingfromzerovelocity.
QEasingCurve.InOutSine PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutsine.png..raw::html<br/>Easingcurveforasinusoidal(sin(t))function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInSine PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinsine.png..raw::html<br/>Easingcurveforasinusoidal(sin(t))function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InExpo PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inexpo.png..raw::html<br/>Easingcurveforanexponential(2^t)function:acceleratingfromzerovelocity.
QEasingCurve.OutExpo PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outexpo.png..raw::html<br/>Easingcurveforanexponential(2^t)function:deceleratingfromzerovelocity.
QEasingCurve.InOutExpo PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutexpo.png..raw::html<br/>Easingcurveforanexponential(2^t)function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInExpo PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinexpo.png..raw::html<br/>Easingcurveforanexponential(2^t)function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InCirc PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-incirc.png..raw::html<br/>Easingcurveforacircular(sqrt(1-t^2))function:acceleratingfromzerovelocity.
QEasingCurve.OutCirc PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outcirc.png..raw::html<br/>Easingcurveforacircular(sqrt(1-t^2))function:deceleratingfromzerovelocity.
QEasingCurve.InOutCirc PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutcirc.png..raw::html<br/>Easingcurveforacircular(sqrt(1-t^2))function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInCirc PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outincirc.png..raw::html<br/>Easingcurveforacircular(sqrt(1-t^2))function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InElastic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inelastic.png..raw::html<br/>Easingcurveforanelastic(exponentiallydecayingsinewave)function:acceleratingfromzerovelocity.Thepeakamplitudecanbesetwiththe*amplitude*parameter,andtheperiodofdecaybythe*period*parameter.
QEasingCurve.OutElastic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outelastic.png..raw::html<br/>Easingcurveforanelastic(exponentiallydecayingsinewave)function:deceleratingfromzerovelocity.Thepeakamplitudecanbesetwiththe*amplitude*parameter,andtheperiodofdecaybythe*period*parameter.
QEasingCurve.InOutElastic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutelastic.png..raw::html<br/>Easingcurveforanelastic(exponentiallydecayingsinewave)function:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInElastic PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinelastic.png..raw::html<br/>Easingcurveforanelastic(exponentiallydecayingsinewave)function:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InBack PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inback.png..raw::html<br/>Easingcurveforaback(overshootingcubicfunction:(s+1)\*t^3-s\*t^2)easingin:acceleratingfromzerovelocity.
QEasingCurve.OutBack PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outback.png..raw::html<br/>Easingcurveforaback(overshootingcubicfunction:(s+1)\*t^3-s\*t^2)easingout:deceleratingtozerovelocity.
QEasingCurve.InOutBack PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutback.png..raw::html<br/>Easingcurveforaback(overshootingcubicfunction:(s+1)\*t^3-s\*t^2)easingin/out:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInBack PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinback.png..raw::html<br/>Easingcurveforaback(overshootingcubiceasing:(s+1)\*t^3-s\*t^2)easingout/in:decelerationuntilhalfway,thenacceleration.
QEasingCurve.InBounce PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inbounce.png..raw::html<br/>Easingcurveforabounce(exponentiallydecayingparabolicbounce)function:acceleratingfromzerovelocity.
QEasingCurve.OutBounce PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outbounce.png..raw::html<br/>Easingcurveforabounce(exponentiallydecayingparabolicbounce)function:deceleratingfromzerovelocity.
QEasingCurve.InOutBounce PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-inoutbounce.png..raw::html<br/>Easingcurveforabounce(exponentiallydecayingparabolicbounce)functioneasingin/out:accelerationuntilhalfway,thendeceleration.
QEasingCurve.OutInBounce PySide/QtCore/../../../../../../../src/qt-everywhere-opensource-src-4.7.2/doc/src/images/qeasingcurve-outinbounce.png..raw::html<br/>Easingcurveforabounce(exponentiallydecayingparabolicbounce)functioneasingout/in:decelerationuntilhalfway,thenacceleration.
QEasingCurve.Custom This is returned if the user specified a custom curve type with PySide.QtCore.QEasingCurve.setCustomType() . Note that you cannot call PySide.QtCore.QEasingCurve.setType() with this value, but PySide.QtCore.QEasingCurve.type() can return it.
PySide.QtCore.QEasingCurve.amplitude()
Return type:PySide.QtCore.qreal

Returns the amplitude. This is not applicable for all curve types. It is only applicable for bounce and elastic curves (curves of PySide.QtCore.QEasingCurve.type() QEasingCurve.InBounce , QEasingCurve.OutBounce , QEasingCurve.InOutBounce , QEasingCurve.OutInBounce , QEasingCurve.InElastic , QEasingCurve.OutElastic , QEasingCurve.InOutElastic or QEasingCurve.OutInElastic ).

PySide.QtCore.QEasingCurve.customType()
Return type:PyObject
PySide.QtCore.QEasingCurve.__ne__(other)
Parameters:otherPySide.QtCore.QEasingCurve
Return type:PySide.QtCore.bool

Compare this easing curve with other and returns true if they are not equal. It will also compare the properties of a curve.

See also

PySide.QtCore.QEasingCurve.operator==()

PySide.QtCore.QEasingCurve.__eq__(other)
Parameters:otherPySide.QtCore.QEasingCurve
Return type:PySide.QtCore.bool

Compare this easing curve with other and returns true if they are equal. It will also compare the properties of a curve.

PySide.QtCore.QEasingCurve.overshoot()
Return type:PySide.QtCore.qreal

Returns the overshoot. This is not applicable for all curve types. It is only applicable if PySide.QtCore.QEasingCurve.type() is QEasingCurve.InBack , QEasingCurve.OutBack , QEasingCurve.InOutBack or QEasingCurve.OutInBack .

PySide.QtCore.QEasingCurve.period()
Return type:PySide.QtCore.qreal

Returns the period. This is not applicable for all curve types. It is only applicable if PySide.QtCore.QEasingCurve.type() is QEasingCurve.InElastic , QEasingCurve.OutElastic , QEasingCurve.InOutElastic or QEasingCurve.OutInElastic .

PySide.QtCore.QEasingCurve.setAmplitude(amplitude)
Parameters:amplitudePySide.QtCore.qreal

Sets the amplitude to amplitude .

This will set the amplitude of the bounce or the amplitude of the elastic “spring” effect. The higher the number, the higher the amplitude.

PySide.QtCore.QEasingCurve.setCustomType(arg__1)
Parameters:arg__1PyObject
PySide.QtCore.QEasingCurve.setOvershoot(overshoot)
Parameters:overshootPySide.QtCore.qreal

Sets the overshoot to overshoot .

0 produces no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent.

PySide.QtCore.QEasingCurve.setPeriod(period)
Parameters:periodPySide.QtCore.qreal

Sets the period to period . Setting a small period value will give a high frequency of the curve. A large period will give it a small frequency.

PySide.QtCore.QEasingCurve.setType(type)
Parameters:typePySide.QtCore.QEasingCurve.Type

Sets the type of the easing curve to type .

PySide.QtCore.QEasingCurve.type()
Return type:PySide.QtCore.QEasingCurve.Type

Returns the type of the easing curve.

PySide.QtCore.QEasingCurve.valueForProgress(progress)
Parameters:progressPySide.QtCore.qreal
Return type:PySide.QtCore.qreal

Return the effective progress for the easing curve at progress . While progress must be between 0 and 1, the returned effective progress can be outside those bounds. For instance, QEasingCurve.InBack will return negative values in the beginning of the function.