標籤:
很簡單的一個效果。我直接了。
代碼就不詳細說了,貼出關鍵代碼就行了。
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.save(); canvas.drawCircle(width / 2, height / 2, interRadius, interCirclePaint); if (list != null && list.size() > 0){ int listSize = list.size() ; int removeIndex = -1 ; for (int i = 0 ; i < listSize ; i ++){ CircleInfo mcircleInfo = list.get(i); outPaint.setColor(mcircleInfo.color); outPaint.setAlpha( 255 - mcircleInfo.radius * 255 / outCircleMaxRadius); mcircleInfo.radius = mcircleInfo.radius + 1 ; if (mcircleInfo.radius > outCircleMaxRadius){ removeIndex = i ; }else { canvas.drawCircle(width/2 , height /2 , mcircleInfo.radius , outPaint); } } if (removeIndex > 0 ){ list.remove(removeIndex); removeIndex = -1 ; } } canvas.restore();
if (list == null){ animatorControl(); }
postInvalidate(); }
代碼: https://github.com/flyme2012/EasyWave
來自為知筆記(Wiz)
附件列表
Android自訂之仿360Root大師水紋效果