2016-06-23 14 views
0

私はdrawCircle()を使って円を描いているキャンバスを持っています。これらの円の半径の増加をアニメーション化する必要があります。私が理解する限り、VectorDrawableとAnimatedVectorDrawableを使用してこれを行うことは可能です。誰もそれを行う方法の例を提供することはできますか?それをどうやってもっとうまくいくのでしょうか?Androidでのアニメーション

+2

あなたは1を見ている必要があります)https://developer.android.com/guide/topics/graphics/drawable-animation.htmlと2で)https://github.com/codepath/android_guides/wiki/Animations –

答えて

0

キャンバスで円をアニメーション化するためにMatrixを使用することにしました。

private int x; 
private int y; 
private Canvas tempCanvas; 
private Matrix matrix = new Matrix(); 
private Path path = new Path(); 

animateCircle(){ 
Paint myPaint = new Paint(); 
myPaint.setAntiAlias(true); 
myPaint.setColor(Color.RED); 
path.addCircle(x, y, 10, Path.Direction.CW); 
//increasing radius of the certain circle 
matrix.setScale(1.1f, 1.1f, x-5, y-5); 
path.transform(matrix); 
tempCanvas.drawPath(path, myPaint4); 
} 
関連する問題