102 \o \l{QMetaType::}{Double} |
102 \o \l{QMetaType::}{Double} |
103 \o \l{QMetaType::}{Float} |
103 \o \l{QMetaType::}{Float} |
104 \o \l{QMetaType::}{QLine} |
104 \o \l{QMetaType::}{QLine} |
105 \o \l{QMetaType::}{QLineF} |
105 \o \l{QMetaType::}{QLineF} |
106 \o \l{QMetaType::}{QPoint} |
106 \o \l{QMetaType::}{QPoint} |
|
107 \o \l{QMetaType::}{QPointF} |
107 \o \l{QMetaType::}{QSize} |
108 \o \l{QMetaType::}{QSize} |
108 \o \l{QMetaType::}{QSizeF} |
109 \o \l{QMetaType::}{QSizeF} |
109 \o \l{QMetaType::}{QRect} |
110 \o \l{QMetaType::}{QRect} |
110 \o \l{QMetaType::}{QRectF} |
111 \o \l{QMetaType::}{QRectF} |
|
112 \o \l{QMetaType::}{QColor} |
111 \endlist |
113 \endlist |
112 |
114 |
113 If you need to interpolate other variant types, including custom |
115 If you need to interpolate other variant types, including custom |
114 types, you have to implement interpolation for these yourself. |
116 types, you have to implement interpolation for these yourself. |
115 You do this by reimplementing interpolated(), which returns |
117 To do this, you can register an interpolator function for a given |
|
118 type. This function takes 3 parameters: the start value, the end value |
|
119 and the current progress. |
|
120 |
|
121 Example: |
|
122 \code |
|
123 QVariant myColorInterpolator(const QColor &start, const QColor &end, qreal progress) |
|
124 { |
|
125 ... |
|
126 return QColor(...); |
|
127 } |
|
128 ... |
|
129 qRegisterAnimationInterpolator<QColor>(myColorInterpolator); |
|
130 \endcode |
|
131 |
|
132 Another option is to reimplement interpolated(), which returns |
116 interpolation values for the value being interpolated. |
133 interpolation values for the value being interpolated. |
117 |
134 |
118 \omit We need some snippets around here. \endomit |
135 \omit We need some snippets around here. \endomit |
119 |
136 |
120 \sa QPropertyAnimation, QAbstractAnimation, {The Animation Framework} |
137 \sa QPropertyAnimation, QAbstractAnimation, {The Animation Framework} |
354 interpolation. Other curves are provided, for instance, |
371 interpolation. Other curves are provided, for instance, |
355 QEasingCurve::InCirc, which provides a circular entry curve. |
372 QEasingCurve::InCirc, which provides a circular entry curve. |
356 Another example is QEasingCurve::InOutElastic, which provides an |
373 Another example is QEasingCurve::InOutElastic, which provides an |
357 elastic effect on the values of the interpolated variant. |
374 elastic effect on the values of the interpolated variant. |
358 |
375 |
|
376 QVariantAnimation will use the QEasingCurve::valueForProgress() to |
|
377 transform the "normalized progress" (currentTime / totalDuration) |
|
378 of the animation into the effective progress actually |
|
379 used by the animation. It is this effective progress that will be |
|
380 the progress when interpolated() is called. Also, the steps in the |
|
381 keyValues are referring to this effective progress. |
|
382 |
359 The easing curve is used with the interpolator, the interpolated() |
383 The easing curve is used with the interpolator, the interpolated() |
360 virtual function, the animation's duration, and iterationCount, to |
384 virtual function, the animation's duration, and iterationCount, to |
361 control how the current value changes as the animation progresses. |
385 control how the current value changes as the animation progresses. |
362 */ |
386 */ |
363 QEasingCurve QVariantAnimation::easingCurve() const |
387 QEasingCurve QVariantAnimation::easingCurve() const |