7#include <QtCore/qglobal.h>
11#include <QtCore/qcompare.h>
12#include <QtCore/qlist.h>
13#include <QtCore/qobjectdefs.h>
17class QEasingCurvePrivate;
25 InQuad, OutQuad, InOutQuad, OutInQuad,
26 InCubic, OutCubic, InOutCubic, OutInCubic,
27 InQuart, OutQuart, InOutQuart, OutInQuart,
28 InQuint, OutQuint, InOutQuint, OutInQuint,
29 InSine, OutSine, InOutSine, OutInSine,
30 InExpo, OutExpo, InOutExpo, OutInExpo,
31 InCirc, OutCirc, InOutCirc, OutInCirc,
32 InElastic, OutElastic, InOutElastic, OutInElastic,
33 InBack, OutBack, InOutBack, OutInBack,
34 InBounce, OutBounce, InOutBounce, OutInBounce,
35 InCurve, OutCurve, SineCurve, CosineCurve,
36 BezierSpline, TCBSpline, Custom, NCurveTypes
40 QEasingCurve(Type type = Linear);
41 QEasingCurve(
const QEasingCurve &other);
44 QEasingCurve &operator=(
const QEasingCurve &other)
45 {
if (
this != &other ) { QEasingCurve copy(other); swap(copy); }
return *
this; }
46 QEasingCurve(QEasingCurve &&other)
noexcept : d_ptr(other.d_ptr) { other.d_ptr =
nullptr; }
47 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEasingCurve)
49 void swap(QEasingCurve &other)
noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
51#if QT_CORE_REMOVED_SINCE(6
, 8
)
52 bool operator==(
const QEasingCurve &other)
const;
53 inline bool operator!=(
const QEasingCurve &other)
const
54 {
return !(
this->operator==(other)); }
57 qreal amplitude()
const;
58 void setAmplitude(qreal amplitude);
61 void setPeriod(qreal period);
63 qreal overshoot()
const;
64 void setOvershoot(qreal overshoot);
66 void addCubicBezierSegment(
const QPointF &c1,
const QPointF &c2,
const QPointF &endPoint);
67 void addTCBSegment(
const QPointF &nextPoint, qreal t, qreal c, qreal b);
68 QList<QPointF> toCubicSpline()
const;
71 void setType(Type type);
72 typedef qreal (*EasingFunction)(qreal progress);
73 void setCustomType(EasingFunction func);
74 EasingFunction customType()
const;
76 qreal valueForProgress(qreal progress)
const;
79 QEasingCurvePrivate *d_ptr;
80#ifndef QT_NO_DEBUG_STREAM
81 friend Q_CORE_EXPORT QDebug operator<<(QDebug debug,
const QEasingCurve &item);
83#ifndef QT_NO_DATASTREAM
84 friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &,
const QEasingCurve &);
85 friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
87 friend Q_CORE_EXPORT
bool
88 comparesEqual(
const QEasingCurve &lhs,
const QEasingCurve &rhs);
89#if !QT_CORE_REMOVED_SINCE(6
, 8
)
90 Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QEasingCurve)
95#ifndef QT_NO_DEBUG_STREAM
96Q_CORE_EXPORT
QDebug operator<<(QDebug debug,
const QEasingCurve &item);
99#ifndef QT_NO_DATASTREAM
100Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QEasingCurve &);
101Q_CORE_EXPORT
QDataStream &operator>>(QDataStream &, QEasingCurve &);
\inmodule QtCore\reentrant
virtual ~QEasingCurveFunction()
bool operator==(const QEasingCurveFunction &other) const
QEasingCurveFunction(QEasingCurve::Type type, qreal period=0.3, qreal amplitude=1.0, qreal overshoot=1.70158)
virtual qreal value(qreal t)
virtual QEasingCurveFunction * copy() const
QList< QPointF > _bezierCurves
\inmodule QtCore\reentrant
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
static QList< QPointF > tcbToBezier(const TCBPoints &tcbPoints)
static QEasingCurve::EasingFunction curveToFunc(QEasingCurve::Type curve)
Q_DECLARE_TYPEINFO(TCBPoint, Q_PRIMITIVE_TYPE)
static QT_BEGIN_NAMESPACE constexpr bool isConfigFunction(QEasingCurve::Type type)
QDataStream & operator<<(QDataStream &stream, QEasingCurveFunction *func)
QList< TCBPoint > TCBPoints
QDataStream & operator>>(QDataStream &stream, QEasingCurveFunction *func)
QDataStream & operator>>(QDataStream &stream, TCBPoint &point)
static QEasingCurveFunction * curveToFunctionObject(QEasingCurve::Type type)
QDataStream & operator<<(QDataStream &stream, const TCBPoint &point)
QT_REQUIRE_CONFIG(easingcurve)
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
bool comparesEqual(const QFileInfo &lhs, const QFileInfo &rhs)
QEasingCurveFunction * copy() const override
qreal value(qreal t) override
BackEase(QEasingCurve::Type type)
static float _fast_cbrt(float x)
static qreal evaluateDerivateForX(const SingleCubicBezier &singleCubicBezier, qreal t)
static qreal evaluateForX(const SingleCubicBezier &singleCubicBezier, qreal t)
static qreal _acos(qreal x)
static void cosacos(qreal x, qreal &s1, qreal &s2, qreal &s3)
static qreal _cos(qreal x)
static qreal _cbrt(qreal d)
static qreal newtonIteration(const SingleCubicBezier &singleCubicBezier, qreal t, qreal x)
static qreal evaluateSegmentForY(const SingleCubicBezier &singleCubicBezier, qreal t)
QList< SingleCubicBezier > _curves
static qreal singleRealSolutionForCubic(qreal a, qreal b, qreal c)
qreal value(qreal x) override
QEasingCurveFunction * copy() const override
void getBezierSegment(SingleCubicBezier *&singleCubicBezier, qreal x)
static qreal findTForX(const SingleCubicBezier &singleCubicBezier, qreal x)
BezierEase(QEasingCurve::Type type=QEasingCurve::BezierSpline)
QList< qreal > _intervals
static double _fast_cbrt(double d)
static bool inRange(qreal f)
static bool almostZero(qreal value)
BounceEase(QEasingCurve::Type type)
QEasingCurveFunction * copy() const override
qreal value(qreal t) override
qreal value(qreal t) override
ElasticEase(QEasingCurve::Type type)
QEasingCurveFunction * copy() const override
QEasingCurveFunction * copy() const override
qreal value(qreal x) override
bool operator==(const TCBPoint &other) const
TCBPoint(QPointF point, qreal t, qreal c, qreal b)