私は、いくつかの円を描画するカスタムビューと、常に更新される約10個のアーチ(回転とサイズの変更)があります。私はこの全過程をアニメーション化しようとしていますが、キャンバスの下で行うための良いプラクティスを見つけることができませんでした(私は基本を知っています--pxの代わりにdpを使用します)。しかし、アニメーション部分。Android Canvasで図形をアニメーション化するためのベストプラクティス
今私はすべてのオブジェクトをトラフして、将来の位置を決定して描画するために計算を実行しますが、それは不安定に見えます。私が現在やっていることは次のとおりです。
@Override
protected void onDraw(Canvas canvas) {
for(Arch arch : arches) {
arch.update();
canvas.drawArc(arch.getRect(), -arch.getCurrentRotation(), arch.getSweepAngle(), true, paint);
}
//logo.draw(canvas);
canvas.drawCircle(width/2, height/2, circle_size, paint_opaque);
logo.draw(canvas);
int textX = (int) (width/2);
int textY = (int) ((height/2) - ((paint_text.descent() + paint_text.ascent())/2));
canvas.drawText(text, textX, textY, paint_text);
invalidate();
}