自定义柱状图,并实现了3种属性动画(横向,纵向,横纵混合)
for (int i = 0; i < mBarCount; i++) {
if (i < count * mBarProgress) {
float maginTop = getMaginTop(mStepArray[i]);
RectF recf = new RectF((mBarWidth + mBarMaginLeft) * i, mBarMaxHeight - maginTop + mBarMaginTop,
mBarWidth * (i + 1) + mBarMaginLeft * i, mBarMaxHeight + mBarMaginTop);
canvas.drawRoundRect(recf, roundWidthX, roundWidthY, mBarPaint);
}
}
for (int i = 0; i < mBarCount; i++) {
if (i < count) {
float maginTop = getMaginTop(mStepArray[i]);
RectF recf = new RectF((mBarWidth + mBarMaginLeft) * i, mBarMaxHeight-(mBarMaxHeight-maginTop)*mBarProgress + mBarMaginTop,
mBarWidth * (i + 1) + mBarMaginLeft * i, mBarMaxHeight + mBarMaginTop);
canvas.drawRoundRect(recf, roundWidthX, roundWidthY, mBarPaint);
}
}
for (int i = 0; i < mBarCount*mBarProgress; i++) {
if (i < count) {
float maginTop = getMaginTop(mStepArray[i]);
RectF recf = new RectF((mBarWidth + mBarMaginLeft) * i, mBarMaxHeight-(mBarMaxHeight-maginTop)*mBarProgress + mBarMaginTop,
mBarWidth * (i + 1) + mBarMaginLeft * i, mBarMaxHeight + mBarMaginTop);
canvas.drawRoundRect(recf, roundWidthX, roundWidthY, mBarPaint);
}
}