summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qdeclarativespringanimation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/util/qdeclarativespringanimation.cpp')
-rw-r--r--src/declarative/util/qdeclarativespringanimation.cpp57
1 files changed, 44 insertions, 13 deletions
diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp
index 4cf2fc0..8ce4832 100644
--- a/src/declarative/util/qdeclarativespringanimation.cpp
+++ b/src/declarative/util/qdeclarativespringanimation.cpp
@@ -207,14 +207,26 @@ void QDeclarativeSpringAnimationPrivate::updateMode()
\qmlclass SpringAnimation QDeclarativeSpringAnimation
\since 4.7
- \brief The SpringAnimation element allows a property to track a value in a spring-like motion
+ \brief The SpringAnimation element allows a property to track a value in a spring-like motion.
SpringAnimation mimics the oscillatory behavior of a spring, with the appropriate \l spring constant to
control the acceleration and the \l damping to control how quickly the effect dies away.
You can also limit the maximum \l velocity of the animation.
+ The following \l Rectangle moves to the position of the mouse using a
+ SpringAnimation when the mouse is clicked. The use of the \l Behavior
+ on the \c x and \c y values indicates that whenever these values are
+ changed, a SpringAnimation should be applied.
+ \snippet doc/src/snippets/declarative/springanimation.qml 0
+
+ Like any other animation element, a SpringAnimation can be applied in a
+ number of ways, including transitions, behaviors and property value
+ sources. The \l PropertyAnimation documentation shows a variety of methods
+ for creating animations.
+
+ \sa SmoothedAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example}
*/
QDeclarativeSpringAnimation::QDeclarativeSpringAnimation(QObject *parent)
@@ -244,6 +256,11 @@ qreal QDeclarativeSpringAnimation::to() const
/*!
\qmlproperty real SpringAnimation::to
+
+ This property holds the value at which the animation will end.
+
+ If not set, the animation will continue until it reaches the
+ value that is being tracked.
*/
void QDeclarativeSpringAnimation::setTo(qreal value)
@@ -266,6 +283,11 @@ qreal QDeclarativeSpringAnimation::from() const
/*!
\qmlproperty real SpringAnimation::from
+
+ This property holds the value from which the animation will begin.
+
+ If not set, the animation will start whenever the tracked value has
+ changed, regardless of its value.
*/
void QDeclarativeSpringAnimation::setFrom(qreal value)
@@ -283,7 +305,10 @@ void QDeclarativeSpringAnimation::setFrom(qreal value)
/*!
\qmlproperty real SpringAnimation::velocity
+
This property holds the maximum velocity allowed when tracking the source.
+
+ The default value is 0 (no maximum velocity).
*/
qreal QDeclarativeSpringAnimation::velocity() const
@@ -302,13 +327,14 @@ void QDeclarativeSpringAnimation::setVelocity(qreal velocity)
/*!
\qmlproperty real SpringAnimation::spring
- This property holds the spring constant
- The spring constant describes how strongly the target is pulled towards the
- source. Setting spring to 0 turns off spring tracking. Useful values 0 - 5.0
+ This property describes how strongly the target is pulled towards the
+ source. The default value is 0 (that is, the spring-like motion is disabled).
+
+ The useful value range is 0 - 5.0.
- When a spring constant is set and the velocity property is greater than 0,
- velocity limits the maximum speed.
+ When this property is set and the \l velocity value is greater than 0,
+ the \l velocity limits the maximum speed.
*/
qreal QDeclarativeSpringAnimation::spring() const
{
@@ -325,10 +351,13 @@ void QDeclarativeSpringAnimation::setSpring(qreal spring)
/*!
\qmlproperty real SpringAnimation::damping
- This property holds the spring damping constant
+ This property holds the spring damping value.
+
+ This value describes how quickly the spring-like motion comes to rest.
+ The default value is 0.
- The damping constant describes how quickly a sprung follower comes to rest.
- Useful range is 0 - 1.0
+ The useful value range is 0 - 1.0. The lower the value, the faster it
+ comes to rest.
*/
qreal QDeclarativeSpringAnimation::damping() const
{
@@ -348,7 +377,7 @@ void QDeclarativeSpringAnimation::setDamping(qreal damping)
/*!
\qmlproperty real SpringAnimation::epsilon
- This property holds the spring epsilon
+ This property holds the spring epsilon.
The epsilon is the rate and amount of change in the value which is close enough
to 0 to be considered equal to zero. This will depend on the usage of the value.
@@ -370,7 +399,7 @@ void QDeclarativeSpringAnimation::setEpsilon(qreal epsilon)
/*!
\qmlproperty real SpringAnimation::modulus
- This property holds the modulus value.
+ This property holds the modulus value. The default value is 0.
Setting a \a modulus forces the target value to "wrap around" at the modulus.
For example, setting the modulus to 360 will cause a value of 370 to wrap around to 10.
@@ -395,8 +424,10 @@ void QDeclarativeSpringAnimation::setModulus(qreal modulus)
\qmlproperty real SpringAnimation::mass
This property holds the "mass" of the property being moved.
- mass is 1.0 by default. Setting a different mass changes the dynamics of
- a \l spring follow.
+ The value is 1.0 by default.
+
+ A greater mass causes slower movement and a greater spring-like
+ motion when an item comes to rest.
*/
qreal QDeclarativeSpringAnimation::mass() const
{