##// END OF EJS Templates
optimized calculations for stacked bar animation
sauimone -
r1430:aef513fa0d93
parent child
Show More
@@ -45,14 +45,13 QVariant PercentBarAnimation::interpolated(const QVariant &from, const QVariant
45
45
46 Q_ASSERT(startVector.count() == endVector.count());
46 Q_ASSERT(startVector.count() == endVector.count());
47
47
48 qreal zeroPos = ((m_item->geometry().height() + m_item->geometry().y()) * (1 - progress));
48 qreal yAxis = m_item->geometry().height() + m_item->geometry().y();
49
49
50 for(int i = 0; i < startVector.count(); i++) {
50 for(int i = 0; i < startVector.count(); i++) {
51 qreal w = endVector[i].width();
51 qreal w = endVector[i].width();
52 qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress);
52 qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress);
53 qreal x = endVector[i].topLeft().x();
53 qreal x = endVector[i].topLeft().x();
54 qreal y = startVector[i].topLeft().y() + ((endVector[i].topLeft().y() - startVector[i].topLeft().y()) * progress)
54 qreal y = yAxis + ((endVector[i].topLeft().y() - yAxis) * progress);
55 + zeroPos;
56
55
57 QRectF value(x,y,w,h);
56 QRectF value(x,y,w,h);
58 result << value;
57 result << value;
@@ -45,14 +45,13 QVariant StackedBarAnimation::interpolated(const QVariant &from, const QVariant
45
45
46 Q_ASSERT(startVector.count() == endVector.count());
46 Q_ASSERT(startVector.count() == endVector.count());
47
47
48 qreal zeroPos = ((m_item->geometry().height() + m_item->geometry().y()) * (1 - progress));
48 qreal yAxis = m_item->geometry().height() + m_item->geometry().y();
49
49
50 for(int i = 0; i < startVector.count(); i++) {
50 for(int i = 0; i < startVector.count(); i++) {
51 qreal w = endVector[i].width();
51 qreal w = endVector[i].width();
52 qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress);
52 qreal h = startVector[i].height() + ((endVector[i].height() - startVector[i].height()) * progress);
53 qreal x = endVector[i].topLeft().x();
53 qreal x = endVector[i].topLeft().x();
54 qreal y = startVector[i].topLeft().y() + ((endVector[i].topLeft().y() - startVector[i].topLeft().y()) * progress)
54 qreal y = yAxis + ((endVector[i].topLeft().y() - yAxis) * progress);
55 + zeroPos;
56
55
57 QRectF value(x,y,w,h);
56 QRectF value(x,y,w,h);
58 result << value;
57 result << value;
General Comments 0
You need to be logged in to leave comments. Login now