summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp63
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h12
2 files changed, 74 insertions, 1 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 27f37df..4f7719b 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -1674,7 +1674,7 @@ void QDeclarativePropertyAnimationPrivate::init()
/*!
\qmlproperty int PropertyAnimation::duration
- This property holds the duration of the transition, in milliseconds.
+ This property holds the duration of the animation, in milliseconds.
The default value is 250.
*/
@@ -2690,6 +2690,67 @@ QDeclarativeListProperty<QDeclarativeItem> QDeclarativeAnchorAnimation::targets(
return QDeclarativeListProperty<QDeclarativeItem>(this, d->targets);
}
+/*!
+ \qmlproperty int AnchorAnimation::duration
+ This property holds the duration of the animation, in milliseconds.
+
+ The default value is 250.
+*/
+int QDeclarativeAnchorAnimation::duration() const
+{
+ Q_D(const QDeclarativeAnchorAnimation);
+ return d->va->duration();
+}
+
+void QDeclarativeAnchorAnimation::setDuration(int duration)
+{
+ if (duration < 0) {
+ qmlInfo(this) << tr("Cannot set a duration of < 0");
+ return;
+ }
+
+ Q_D(QDeclarativeAnchorAnimation);
+ if (d->va->duration() == duration)
+ return;
+ d->va->setDuration(duration);
+ emit durationChanged(duration);
+}
+
+/*!
+ \qmlproperty enumeration AnchorAnimation::easing.type
+ \qmlproperty real AnchorAnimation::easing.amplitude
+ \qmlproperty real AnchorAnimation::easing.overshoot
+ \qmlproperty real AnchorAnimation::easing.period
+ \brief the easing curve used for the animation.
+
+ To specify an easing curve you need to specify at least the type. For some curves you can also specify
+ amplitude, period and/or overshoot. The default easing curve is
+ Linear.
+
+ \qml
+ AnchorAnimation { easing.type: "InOutQuad" }
+ \endqml
+
+ See the \l{PropertyAnimation::easing.type} documentation for information
+ about the different types of easing curves.
+*/
+
+QEasingCurve QDeclarativeAnchorAnimation::easing() const
+{
+ Q_D(const QDeclarativeAnchorAnimation);
+ return d->va->easingCurve();
+}
+
+void QDeclarativeAnchorAnimation::setEasing(const QEasingCurve &e)
+{
+ Q_D(QDeclarativeAnchorAnimation);
+ if (d->va->easingCurve() == e)
+ return;
+
+ d->va->setEasingCurve(e);
+ emit easingChanged(e);
+}
+
void QDeclarativeAnchorAnimation::transition(QDeclarativeStateActions &actions,
QDeclarativeProperties &modified,
TransitionDirection direction)
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index c839c2c..40c893c 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -475,6 +475,8 @@ class QDeclarativeAnchorAnimation : public QDeclarativeAbstractAnimation
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeAnchorAnimation)
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem> targets READ targets)
+ Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
+ Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
public:
QDeclarativeAnchorAnimation(QObject *parent=0);
@@ -482,6 +484,16 @@ public:
QDeclarativeListProperty<QDeclarativeItem> targets();
+ int duration() const;
+ void setDuration(int);
+
+ QEasingCurve easing() const;
+ void setEasing(const QEasingCurve &);
+
+Q_SIGNALS:
+ void durationChanged(int);
+ void easingChanged(const QEasingCurve&);
+
protected:
virtual void transition(QDeclarativeStateActions &actions,
QDeclarativeProperties &modified,