LoginButton
android 實(shí)現(xiàn)登錄按鈕動(dòng)畫效果
先上傳一張效果圖:
好的正什,再來(lái)看一下實(shí)現(xiàn)思路移剪。
實(shí)現(xiàn)思路:
整個(gè)動(dòng)畫過(guò)程大致分為3步:
① 從矩形-->圓角矩形-->圓
②圓弧旋轉(zhuǎn)病最終轉(zhuǎn)至下巴位置
③眼睛上升
動(dòng)畫關(guān)鍵代碼
第一步的動(dòng)畫繪制:
private void draw_oval_to_circle(Canvas canvas) {
? ?rectf.left=actual_move_distance;
? ?rectf.top=0;
? ?rectf.right=width-actual_move_distance;
? ?rectf.bottom=height;
? ?//畫圓角矩形
? ?canvas.drawRoundRect(rectf,circleAngle,circleAngle,paint);
}
第二步的動(dòng)畫繪制:
private void draw_arc_to_smile(Canvas canvas){
? ?arcRectf.left=width/2-height/4;
? ?arcRectf.right=width/2+height/4;
? ?arcRectf.top=height/4;
? ?arcRectf.bottom=height*3/4;
? ?canvas.drawArc(arcRectf,startAngle,180,false,smilePaint);
}
第三部的動(dòng)畫繪制:
private void draw_point_move_up(Canvas canvas){
? ?intpointLeftX =width/2-height/4;
? ?intpointRightX =width/2+height/4;
? ?canvas.drawPoint(pointLeftX+10,height/2-point_move_up_distance,smilePaint);
? ?canvas.drawPoint(pointRightX-10,height/2-point_move_up_distance,smilePaint);
}
最后附上Github地址。
歡迎點(diǎn)評(píng)瓤摧。