android 高仿華為充電動畫

2021-08-30 04:21:28 字數 2783 閱讀 5125

//底部黏性動畫

if (bubblebeans.get(i).gety()<=bubblelist.get(0).y&&bubblelist.get(0).y-bubblebeans.get(i).gety()<15)

//氣泡和 中部圓的黏性動畫

if (bubblebeans.get(i).gety()-arcpointstrat[5].y<110&&rotateangle>20&&rotateangle<100)}}

/*** dip 轉換成 px

** @param dip

* @param context

* @return

*/public float dip2dimension(float dip, context context)

public void circleincoordinatedraw(canvas canvas) else

} else if (i > 5) else

} else

//求弧度座標點的 公式

float radian = (float) math.toradians(angle);

float adjacent = (float) math.cos(radian) * centreradius; //鄰邊

float right = (float) math.sin(radian) * centreradius;//對邊

//求控制點的座標 公式

float radiancontrol = (float) math.toradians(90 - (45 + angle));

float xstrat = (float) math.cos(radiancontrol) * centreradius; //鄰邊

float yend = (float) math.sin(radiancontrol) * centreradius; //對邊

if (i == 0 || i == 1) else

controlp.set(centrecirclepoint.x + yend * controlrate, centrecirclepoint.y + xstrat * controlrate);

} else else

}arcpointstrat[i] = arcstrat;

arcpointend[i] = arcend;

control[i] = controlp;

lastpath.rewind();

lastpath.moveto(arcpointstrat[i].x, arcpointstrat[i].y);

lastpath.quadto(control[i].x, control[i].y, arcpointend[i].x, arcpointend[i].y);

if (i > 3 && i < 6) else

lastpath.rewind();}}

private void setanimation() else else if (i >= 180)

onmdraw();

if (i == 360)

}public void setbubblelist()

}}, 0, 4);}}

**********=  分裝氣泡的類

public class bubblebean 

public void set(float x, float y,float randomy,int index)

public void setmove(int screenheight,int maxdistance)

if (maxdistance<=y&&screenheight-y>110)else

if (index==0)else if (index==2)

}public int getindex()

public float getx()

public void setx(float x)

public float gety()

public void sety(float y)

}

巧用 CSS 實現酷炫的充電動畫

循序漸進,看看只使用 css 可以鼓搗出什麼樣的充電動畫效果。wap.youxs.org 當然,電池充電,首先得用 css 畫乙個電池,這個不難,隨便整乙個 歐了,勉強就是它了。有了電池,那接下來直接充電吧。最最簡單的動畫,那應該是用色彩把整個電池灌滿即可。方法很多,也很簡單,直接看效果 有內味了,...

Android之仿心跳動畫實現

按鈕模擬心臟跳動 privatevoidplayheartbeatanimation override publicvoidonanimationrepeat animation animation override publicvoidonanimationend animation animat...

Android之仿心跳動畫實現

android之仿心跳動畫實現 按鈕模擬心臟跳動 private void playheartbeatanimation override public void onanimationrepeat animation animation override public void onanimati...