From 0a4bf81436e8470172ddfe163e3bd18e67093239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=92=95=E5=92=9A?= <1252768410@qq.com> Date: Fri, 30 Jun 2017 11:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20onDraw=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E9=99=8D=E4=BD=8E=E5=86=85=E5=AD=98=E5=8D=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A5=E5=8F=8A=20GC=20=E9=A2=91=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wang/avi/indicators/BallSpinFadeLoaderIndicator.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/wang/avi/indicators/BallSpinFadeLoaderIndicator.java b/library/src/main/java/com/wang/avi/indicators/BallSpinFadeLoaderIndicator.java index d93fbb3..7f75fc8 100644 --- a/library/src/main/java/com/wang/avi/indicators/BallSpinFadeLoaderIndicator.java +++ b/library/src/main/java/com/wang/avi/indicators/BallSpinFadeLoaderIndicator.java @@ -41,8 +41,12 @@ public void draw(Canvas canvas, Paint paint) { float radius=getWidth()/10; for (int i = 0; i < 8; i++) { canvas.save(); - Point point=circleAt(getWidth(),getHeight(),getWidth()/2-radius,i*(Math.PI/4)); - canvas.translate(point.x,point.y); + double angle = i * (Math.PI / 4); + float realRadius = getWidth()/2-radius; + float x = (float) (getWidth()/2 + realRadius * (Math.cos(angle))); + float y = (float) (getHeight()/2 + realRadius * (Math.sin(angle))); + + canvas.translate(x, y); canvas.scale(scaleFloats[i],scaleFloats[i]); paint.setAlpha(alphas[i]); canvas.drawCircle(0,0,radius,paint);