Easing圓環動畫

2021-09-23 21:15:01 字數 3810 閱讀 7945

easing圓環動畫

/** * 線條寬度

*/@property (nonatomic) cgfloat linewidth;

/** * 線條顏色

*/@property (nonatomic, strong) uicolor *linecolor;

/** * 旋轉方向

*/@property (nonatomic) bool clockwise;

/** * 開始角度

*/@property (nonatomic) cgfloat startangle;

/** * 初始化view

*/- (void)buildview;

/** * 做strokeend動畫

* * @param value 取值 [0, 1]

* @param func 函式指標

* @param animated 是否執行動畫

* @param duration 動畫持續的時間

*/- (void)strokeend:(cgfloat)value animationtype:(aheasingfunction)func animated:(bool)animated duration:(cgfloat)duration;

/** * 做strokestart動畫

* * @param value 取值 [0, 1]

* @param func 函式指標

* @param animated 是否執行動畫

* @param duration 動畫持續的時間

*/- (void)strokestart:(cgfloat)value animationtype:(aheasingfunction)func animated:(bool)animated duration:(cgfloat)duration;

/** * 便利構造器建立出例項物件

* * @param frame frame值

* @param width 線條寬度

* @param color 線條顏色

* @param clockwise 是否是順時鐘

* @param angle 開始是否的角度(取值範圍 0° ~ 360°)

* * @return 例項物件

*/+ (instancetype)circleviewwithframe:(cgrect)frame

linewidth:(cgfloat)width

linecolor:(uicolor *)color

clockwise:(bool)clockwise

startangle:(cgfloat)angle;

@end

//

// circleview.m

// yxmweather

//// created by xianmingyou on 15/11/12.

//#import "circleview.h"

// 將度數轉換為弧度

#define radian(degrees) ((m_pi * (degrees))/ 180.f)

// 將弧度轉換為度數

#define degrees(radian) ((radian) * 180.f / m_pi)

@inte***ce circleview ()

/** * 圓形layer

*/@property (nonatomic, strong) cashapelayer *circlelayer;

@end

@implementation circleview

/** * 初始化frame值

* * @param frame 尺寸值

* * @return 例項物件

*/- (instancetype)initwithframe:(cgrect)frame

return self;

}/**

* 建立出layer

*/- (void)createcirclelayer

/** * 初始化view

*/- (void)buildview else

// 建立出貝塞爾曲線

uibezierpath *circlepath \

= [uibezierpath bezierpathwitharccenter:cgpointmake(size.height / 2.f, size.width / 2.f)

radius:radius

startangle:startangle

endangle:endangle

clockwise:clockwise];

// 獲取path

self.circlelayer.path = circlepath.cgpath;

// 設定顏色

self.circlelayer.strokecolor = linecolor.cgcolor;

self.circlelayer.fillcolor = [[uicolor clearcolor] cgcolor];

self.circlelayer.linewidth = linewidth;

self.circlelayer.strokeend = 0.f;

}- (void)strokeend:(cgfloat)value animationtype:(aheasingfunction)func animated:(bool)animated duration:(cgfloat)duration else if (value >= 1)

if (animated) else

}- (void)strokestart:(cgfloat)value animationtype:(aheasingfunction)func animated:(bool)animated duration:(cgfloat)duration else if (value >= 1)

if (animated) else

}+ (instancetype)circleviewwithframe:(cgrect)frame

linewidth:(cgfloat)width

linecolor:(uicolor *)color

clockwise:(bool)clockwise

startangle:(cgfloat)angle

@end

細節

圓環進度css

看效果先 參考 jquery圓環百分比進度條製作 css clip rect矩形剪裁功能及一些應用介紹 css clip rect幾個值含義示意例項頁面 clip rect下png通道透明下sprite定位例項頁面 clip rect剪裁效果預覽例項頁面 doctype html html lang...

約瑟夫圓環問題

如下 include include include int main 讓陣列迴圈起來 person n 1 編號為n的下乙個人的編號是1 node 1 while node person node count printf d person node 輸出被殺的人編號 person node pe...

圓環進度css

看效果先 參考 jquery圓環百分比進度條製作 css clip rect矩形剪裁功能及一些應用介紹 css clip rect幾個值含義示意例項頁面 clip rect下png通道透明下sprite定位例項頁面 clip rect剪裁效果預覽例項頁面 doctype html html lang...