##// END OF EJS Templates
Sets drawline animation for all points update
Michal Klocek -
r503:4fe5f7a79a8f
parent child
Show More
@@ -58,6 +58,7 void XYChartAnimationItem<T,U>::updatePoints(QVector<QPointF>& newPoints)
58 }
58 }
59
59
60 m_animation->setDuration(duration);
60 m_animation->setDuration(duration);
61 m_animation->setAnimationType(XYChartAnimator<T,U>::LineDrawAnimation);
61 m_animation->setEasingCurve(QEasingCurve::InOutBack);
62 m_animation->setEasingCurve(QEasingCurve::InOutBack);
62 m_animation->setKeyValueAt(0.0, qVariantFromValue(oldPoints));
63 m_animation->setKeyValueAt(0.0, qVariantFromValue(oldPoints));
63 m_animation->setKeyValueAt(1.0, qVariantFromValue(newPoints));
64 m_animation->setKeyValueAt(1.0, qVariantFromValue(newPoints));
@@ -82,6 +83,7 void XYChartAnimationItem<T,U>::updatePoint(QVector<QPointF>& newPoints)
82 }
83 }
83
84
84 m_animation->setDuration(duration);
85 m_animation->setDuration(duration);
86 m_animation->setAnimationType(XYChartAnimator<T,U>::MoveDownAnimation);
85 m_animation->setEasingCurve(QEasingCurve::InOutBack);
87 m_animation->setEasingCurve(QEasingCurve::InOutBack);
86 m_animation->setKeyValueAt(0.0, qVariantFromValue(m_points));
88 m_animation->setKeyValueAt(0.0, qVariantFromValue(m_points));
87 m_animation->setKeyValueAt(1.0, qVariantFromValue(newPoints));
89 m_animation->setKeyValueAt(1.0, qVariantFromValue(newPoints));
@@ -17,6 +17,7 public:
17 enum Animation { LineDrawAnimation, MoveDownAnimation, MoveUpAnimation };
17 enum Animation { LineDrawAnimation, MoveDownAnimation, MoveUpAnimation };
18 XYChartAnimator(XYChartAnimationItem<T,U> *item, QObject *parent = 0 );
18 XYChartAnimator(XYChartAnimationItem<T,U> *item, QObject *parent = 0 );
19 ~XYChartAnimator();
19 ~XYChartAnimator();
20 void setAnimationType(Animation type);
20
21
21 protected:
22 protected:
22 QVariant interpolated(const QVariant &start, const QVariant & end, qreal progress ) const;
23 QVariant interpolated(const QVariant &start, const QVariant & end, qreal progress ) const;
@@ -40,6 +41,12 XYChartAnimator<T,U>::~XYChartAnimator()
40 {
41 {
41 }
42 }
42
43
44 template <class T,class U>
45 void XYChartAnimator<T,U>::setAnimationType(Animation type)
46 {
47 m_type=type;
48 }
49
43 template <class T, class U>
50 template <class T, class U>
44 QVariant XYChartAnimator<T,U>::interpolated(const QVariant &start, const QVariant & end, qreal progress ) const
51 QVariant XYChartAnimator<T,U>::interpolated(const QVariant &start, const QVariant & end, qreal progress ) const
45 {
52 {
General Comments 0
You need to be logged in to leave comments. Login now