/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
QT_BEGIN_NAMESPACE
+/*!
+ \qmlclass PathInterpolator QQuickPathInterpolator
+ \inqmlmodule QtQuick 2
+ \brief The PathInterpolator element provides a way to manually animate along a path.
+
+ PathInterpolator provides \c x, \c y, and \c angle information for a particular \c progress
+ along a path.
+
+ In the following example, we animate a green rectangle along a bezier path.
+
+ \snippet doc/src/snippets/declarative/pathinterpolator.qml 0
+*/
+
QDeclarativePathInterpolator::QDeclarativePathInterpolator(QObject *parent) :
QObject(parent), _path(0), _x(0), _y(0), _angle(0), _progress(0)
{
}
+/*!
+ \qmlproperty Path QtQuick2::PathInterpolator::path
+ This property holds the path to interpolate.
+
+ For more information on defining a path see the \l Path documentation.
+*/
QDeclarativePath *QDeclarativePathInterpolator::path() const
{
return _path;
emit pathChanged();
}
+/*!
+ \qmlproperty real QtQuick2::PathInterpolator::progress
+ This property holds the current progress along the path.
+
+ Typical usage of PathInterpolator is to set the progress
+ (often via a NumberAnimation), and read the corresponding
+ values for x, y, and angle (often via bindings to these values).
+
+ Progress ranges from 0.0 to 1.0.
+*/
qreal QDeclarativePathInterpolator::progress() const
{
return _progress;
_q_pathUpdated();
}
+/*!
+ \qmlproperty real QtQuick2::PathInterpolator::x
+ \qmlproperty real QtQuick2::PathInterpolator::y
+
+ These properties hold the position of the path at \l progress.
+*/
qreal QDeclarativePathInterpolator::x() const
{
return _x;
return _y;
}
+/*!
+ \qmlproperty real QtQuick2::PathInterpolator::angle
+
+ This property holds the angle of the path tangent at \l progress.
+
+ Angles are reported clockwise, with zero degrees at the 3 o'clock position.
+*/
qreal QDeclarativePathInterpolator::angle() const
{
return _angle;
emit yChanged();
}
+ //convert to clockwise
+ angle = qreal(360) - angle;
+ if (qFuzzyCompare(angle, qreal(360)))
+ angle = qreal(0);
+
if (angle != _angle) {
_angle = angle;
emit angleChanged();