iOS的動(dòng)畫效果一直都很棒很,給人的感覺就是很炫酷很流暢,起到增強(qiáng)用戶體驗(yàn)的作用。在APP開發(fā)中實(shí)現(xiàn)動(dòng)畫效果有很多種方式,對(duì)于簡單的應(yīng)用場(chǎng)景,我們可以使用UIKit提供的動(dòng)畫來實(shí)現(xiàn)。
UIView動(dòng)畫
UIView動(dòng)畫實(shí)質(zhì)上是對(duì)CoreAnimation的封裝,iOS4.0以后,增加了Block動(dòng)畫塊,提供更簡潔的方式來實(shí)現(xiàn)動(dòng)畫。
共有六個(gè)常見的Block動(dòng)畫方法:
1、最簡單的Block動(dòng)畫,包含時(shí)間和動(dòng)畫
[UIView animateWithDuration:<#(NSTimeInterval)#> animations:<#^(void)animations#>];
2、帶有動(dòng)畫完成回調(diào)的Block動(dòng)畫
[UIView animateWithDuration:<#(NSTimeInterval)#> animations:<#^(void)animations#> completion:<#^(BOOL finished)completion#>];
3、可設(shè)置延遲時(shí)間和過渡效果的Block動(dòng)畫 ``[UIView animateWithDuration:<#(NSTimeInterval)#> delay:<#(NSTimeInterval)#> options:<#(UIViewAnimationOptions)#> animations:<#^(void)animations#> completion:<#^(BOOL finished)completion#>]
4、Spring動(dòng)畫,iOS7.0后新增Spring動(dòng)畫(iOS系統(tǒng)動(dòng)畫大部分采用SpringAnimation,適用于所有可被添加動(dòng)畫效果的屬性)
[UIView animateWithDuration:<#(NSTimeInterval)#> delay:<#(NSTimeInterval)#> usingSpringWithDamping:<#(CGFloat)#> initialSpringVelocity:<#(CGFloat)#> options:<#(UIViewAnimationOptions)#> animations:<#^(void)animations#> completion:<#^(BOOL finished)completion#>]
5、Keyframes動(dòng)畫,iOS7.0后新增關(guān)鍵幀動(dòng)畫,支持屬性關(guān)鍵幀,不支持路徑關(guān)鍵幀
[UIView animateKeyframesWithDuration:<#(NSTimeInterval)#> delay:<#(NSTimeInterval)#> options:<#(UIViewKeyframeAnimationOptions)#> animations:<#^(void)animations#> completion:<#^(BOOL finished)completion#>]
-
6、轉(zhuǎn)場(chǎng)動(dòng)畫
- 從舊視圖轉(zhuǎn)到新視圖的動(dòng)畫效果,在該動(dòng)畫過程中,fromView會(huì)從父視圖中移除,并講toView添加到父視圖中,注意轉(zhuǎn)場(chǎng)動(dòng)畫的作用對(duì)象是父視圖(過渡效果體現(xiàn)在父視圖上)
[UIView transitionFromView:<#(nonnull UIView *)#> toView:<#(nonnull UIView *)#> duration:<#(NSTimeInterval)#> options:<#(UIViewAnimationOptions)#> completion:<#^(BOOL finished)completion#>]
- 從舊視圖轉(zhuǎn)到新視圖的動(dòng)畫效果,在該動(dòng)畫過程中,fromView會(huì)從父視圖中移除,并講toView添加到父視圖中,注意轉(zhuǎn)場(chǎng)動(dòng)畫的作用對(duì)象是父視圖(過渡效果體現(xiàn)在父視圖上)
單個(gè)視圖的過渡效果
[UIView transitionWithView:<#(nonnull UIView *)#> duration:<#(NSTimeInterval)#> options:<#(UIViewAnimationOptions)#> animations:<#^(void)animations#> completion:<#^(BOOL finished)completion#>]
UIView動(dòng)畫可以設(shè)置的動(dòng)畫屬性有
- 1、大小變化(frame)
- 2、拉伸變化(bounds)
- 3、中心位置變化(center)
- 4、旋轉(zhuǎn)(transform)
- 5、透明度(aipha)
- 6、背景色(backgroundColor)
transform屬性作用:給我們的控件做一些形變,(平移,縮放,旋轉(zhuǎn))
移動(dòng)
// 平移
//每次移動(dòng)都是相對(duì)于上次位置
_redView.transform = CGAffineTransformTranslate(_redView.transform, 100, 0);
//每次移動(dòng)都是相對(duì)于最開始的位置
_redView.transform = CGAffineTransformMakeTranslation(200, 0);
縮放
// sx:寬度縮放的比例 sy:高度縮放的比例
//每次縮放都是相對(duì)于最初的大小
_redView.transform = CGAffineTransformMakeScale(0.5, 0.5);
//每次縮放都是相對(duì)于上次的大小
_redView.transform = CGAffineTransformScale(_redView.transform, 0.5, 0.5);
旋轉(zhuǎn)
// 每次旋轉(zhuǎn)都是相對(duì)于最初的角度
_redView.transform = CGAffineTransformMakeRotation(M_PI_4);
//每次旋轉(zhuǎn)都是相對(duì)于現(xiàn)在的角度
_redView.transform = CGAffineTransformRotate(_redView.transform, M_PI_4);
實(shí)戰(zhàn)說明
1、最簡潔的Block動(dòng)畫:包含時(shí)間和動(dòng)畫
代碼
[UIView animateWithDuration:3 animations:^{
//執(zhí)行動(dòng)畫
_MyView.transform = CGAffineTransformScale(_MyView.transform, 0.5, 0.5);//縮放
_MyView.transform = CGAffineTransformRotate(_MyView.transform, M_PI_4);//旋轉(zhuǎn)
_MyView.transform = CGAffineTransformTranslate(_MyView.transform, 200, 100);//平移
}];
效果圖
2、可設(shè)置延遲時(shí)間和過渡效果的Block動(dòng)畫
代碼
[UIView animateWithDuration:3 delay:1 options:UIViewAnimationOptionTransitionCurlDown animations:^{
//執(zhí)行動(dòng)畫
_MyView.transform = CGAffineTransformScale(_MyView.transform, 0.5, 0.5);//縮放
_MyView.transform = CGAffineTransformRotate(_MyView.transform, M_PI_4);//旋轉(zhuǎn)
_MyView.transform = CGAffineTransformTranslate(_MyView.transform, 200, 100);//平移
} completion:^(BOOL finished) {
NSLog(@"動(dòng)畫完成的回調(diào)");
}];
UIViewAnimationOptions的枚舉值如下,可組合使用
UIViewAnimationOptionLayoutSubviews//進(jìn)行動(dòng)畫時(shí)布局子控件
UIViewAnimationOptionAllowUserInteraction//進(jìn)行動(dòng)畫時(shí)允許用戶交互
UIViewAnimationOptionBeginFromCurrentState//從當(dāng)前狀態(tài)開始動(dòng)畫
UIViewAnimationOptionRepeat//無限重復(fù)執(zhí)行動(dòng)畫
UIViewAnimationOptionAutoreverse//執(zhí)行動(dòng)畫回路
UIViewAnimationOptionOverrideInheritedDuration//忽略嵌套動(dòng)畫的執(zhí)行時(shí)間設(shè)置
UIViewAnimationOptionOverrideInheritedCurve//忽略嵌套動(dòng)畫的曲線設(shè)置
UIViewAnimationOptionAllowAnimatedContent//轉(zhuǎn)場(chǎng):進(jìn)行動(dòng)畫時(shí)重繪視圖
UIViewAnimationOptionShowHideTransitionViews//轉(zhuǎn)場(chǎng):移除(添加和移除圖層的)動(dòng)畫效果
UIViewAnimationOptionOverrideInheritedOptions//不繼承父動(dòng)畫設(shè)置
UIViewAnimationOptionCurveEaseInOut//時(shí)間曲線,慢進(jìn)慢出(默認(rèn)值)
UIViewAnimationOptionCurveEaseIn//時(shí)間曲線,慢進(jìn)
UIViewAnimationOptionCurveEaseOut//時(shí)間曲線,慢出
UIViewAnimationOptionCurveLinear//時(shí)間曲線,勻速
UIViewAnimationOptionTransitionNone//轉(zhuǎn)場(chǎng),不使用動(dòng)畫
UIViewAnimationOptionTransitionFlipFromLeft//轉(zhuǎn)場(chǎng),從左向右旋轉(zhuǎn)翻頁
UIViewAnimationOptionTransitionFlipFromRight//轉(zhuǎn)場(chǎng),從右向左旋轉(zhuǎn)翻頁
UIViewAnimationOptionTransitionCurlUp//轉(zhuǎn)場(chǎng),下往上卷曲翻頁
UIViewAnimationOptionTransitionCurlDown//轉(zhuǎn)場(chǎng),從上往下卷曲翻頁
UIViewAnimationOptionTransitionCrossDissolve//轉(zhuǎn)場(chǎng),交叉消失和出現(xiàn)
UIViewAnimationOptionTransitionFlipFromTop//轉(zhuǎn)場(chǎng),從上向下旋轉(zhuǎn)翻頁
UIViewAnimationOptionTransitionFlipFromBottom//轉(zhuǎn)場(chǎng),從下向上旋轉(zhuǎn)翻頁
3、Spring動(dòng)畫
usingSpringWithDamping
:震動(dòng)效果,范圍0~1,數(shù)值越小震動(dòng)效果越明顯
initialSpringVelocity
:初始速度,數(shù)值越大初始速度越快
[UIView animateWithDuration:3 delay:0 usingSpringWithDamping:0.1 initialSpringVelocity:100 options:UIViewAnimationOptionRepeat animations:^{
//執(zhí)行動(dòng)畫
_MyView.transform = CGAffineTransformScale(_MyView.transform, 0.5, 0.5);//縮放
_MyView.transform = CGAffineTransformRotate(_MyView.transform, M_PI_4);//旋轉(zhuǎn)
_MyView.transform = CGAffineTransformTranslate(_MyView.transform, 200, 100);//平移
} completion:^(BOOL finished) {
}];
效果圖
4、Keyframes動(dòng)畫
iOS7.0后新增關(guān)鍵幀動(dòng)畫,支持屬性關(guān)鍵幀,不支持路徑關(guān)鍵幀
options
:動(dòng)畫的過渡效果
[UIView animateKeyframesWithDuration:0.5 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeCubicPaced animations:^{
_MyView.backgroundColor = [UIColor blueColor];
} completion:nil];
[UIView animateKeyframesWithDuration:1 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeCubicPaced animations:^{
_MyView.backgroundColor = [UIColor grayColor];
} completion:nil];
[UIView animateKeyframesWithDuration:1.5 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeCubicPaced animations:^{
_MyView.backgroundColor = [UIColor greenColor];
} completion:nil];
[UIView animateKeyframesWithDuration:2 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeCubicPaced animations:^{
_MyView.backgroundColor = [UIColor redColor];
} completion:nil];
UIViewKeyframeAnimationOptions的枚舉值如下,可組合使用:
UIViewAnimationOptionLayoutSubviews//進(jìn)行動(dòng)畫時(shí)布局子控件
UIViewAnimationOptionAllowUserInteraction//進(jìn)行動(dòng)畫時(shí)允許用戶交互
UIViewAnimationOptionBeginFromCurrentState//從當(dāng)前狀態(tài)開始動(dòng)畫
UIViewAnimationOptionRepeat//無限重復(fù)執(zhí)行動(dòng)畫
UIViewAnimationOptionAutoreverse//執(zhí)行動(dòng)畫回路
UIViewAnimationOptionOverrideInheritedDuration//忽略嵌套動(dòng)畫的執(zhí)行時(shí)間設(shè)置
UIViewAnimationOptionOverrideInheritedOptions//不繼承父動(dòng)畫設(shè)置
UIViewKeyframeAnimationOptionCalculationModeLinear//運(yùn)算模式:連續(xù)
UIViewKeyframeAnimationOptionCalculationModeDiscrete//運(yùn)算模式:離散
UIViewKeyframeAnimationOptionCalculationModePaced//運(yùn)算模式:均勻執(zhí)行
UIViewKeyframeAnimationOptionCalculationModeCubic//運(yùn)算模式:平滑
UIViewKeyframeAnimationOptionCalculationModeCubicPaced//運(yùn)算模式:平滑均勻
效果圖
5、轉(zhuǎn)場(chǎng)動(dòng)畫
單個(gè)視圖的過渡效果
代碼
[UIView transitionWithView:_MyView duration:1 options:UIViewAnimationOptionOverrideInheritedCurve animations:^{
_MyView.backgroundColor = [UIColor greenColor];
} completion:nil];
效果圖
從舊視圖轉(zhuǎn)到新視圖的動(dòng)畫效果
[UIView transitionFromView:_MyView toView:_view duration:1 options:UIViewAnimationOptionTransitionFlipFromTop completion:nil];
CAAnimation核心動(dòng)畫
在iOS的不同圖形層次中都可以寫動(dòng)畫代碼。越上層,封裝程度越高,動(dòng)畫實(shí)現(xiàn)越簡潔越簡單,但是自由度越低;反之亦然。
如果想要做出更炫的動(dòng)畫,就必須要了解CAAnimation核心動(dòng)畫了。
Core Animation結(jié)構(gòu)
基礎(chǔ)動(dòng)畫(CABasicAnimation)
基礎(chǔ)動(dòng)畫(CABasicAnimation),通過設(shè)定起始點(diǎn),終點(diǎn),時(shí)間,動(dòng)畫會(huì)沿著你這設(shè)定點(diǎn)進(jìn)行移動(dòng)。可以看做特殊的CAKeyFrameAnimation
開始之前我們需要先了解一個(gè)概念:CALayer
CALayer是個(gè)與UIView很類似的概念,同樣有backgroundColor、frame等相似的屬性,我們可以將UIView看做一種特殊的CALayer。但實(shí)際上UIView是對(duì)CALayer封裝,在CALayer的基礎(chǔ)上再添加交互功能。UIView的顯示必須依賴于CALayer。
我們同樣可以跟新建view一樣新建一個(gè)layer,然后添加到某個(gè)已有的layer上,同樣可以對(duì)layer調(diào)整大小、位置、透明度等。
一般來說,layer可以有兩種用途:一是對(duì)view相關(guān)屬性的設(shè)置,包括圓角、陰影、邊框等參數(shù),更詳細(xì)的參數(shù)請(qǐng)點(diǎn)擊這里;二是實(shí)現(xiàn)對(duì)view的動(dòng)畫操控。因此對(duì)一個(gè)view進(jìn)行動(dòng)畫,本質(zhì)上是對(duì)該view的.layer進(jìn)行動(dòng)畫操縱。
注意點(diǎn)1:KeyPath中key值的設(shè)置
實(shí)例化方法
//圍繞y軸旋轉(zhuǎn)
CABasicAnimation *transformAnima = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
使用方法animationWithKeyPath:
對(duì)CABasicAnimation
進(jìn)行實(shí)例化,并指定Layer的屬性作為關(guān)鍵路徑進(jìn)行注冊(cè)。
keyPath
決定了基礎(chǔ)動(dòng)畫的類型,該值不能隨便取,一旦取錯(cuò)就達(dá)不到想要的效果。要改變位置就取position
,要改變透明度就取opacity
,要等比例縮放就取transform.scale
...
一些常用的animationWithKeyPath值的總結(jié)
注意點(diǎn)2:fillMode屬性的理解
該屬性定義了你的動(dòng)畫在開始和結(jié)束時(shí)的動(dòng)作。默認(rèn)值是 kCAFillModeRemoved
fillMode的作用就是決定當(dāng)前對(duì)象過了非active時(shí)間段的行為. 非active時(shí)間段是指動(dòng)畫開始之前以及動(dòng)畫結(jié)束之后。如果是一個(gè)動(dòng)畫CAAnimation,則需要將其removedOnCompletion設(shè)置為NO,要不然fillMode不起作用
.
kCAFillModeRemoved
這個(gè)是默認(rèn)值,也就是說當(dāng)動(dòng)畫開始前和動(dòng)畫結(jié)束后,動(dòng)畫對(duì)layer都沒有影響,動(dòng)畫結(jié)束后,layer會(huì)恢復(fù)到之前的狀態(tài)
kCAFillModeForwards
當(dāng)動(dòng)畫結(jié)束后,layer會(huì)一直保持著動(dòng)畫最后的狀態(tài)
kCAFillModeBackwards
這個(gè)和kCAFillModeForwards是相對(duì)的,就是在動(dòng)畫開始前,你只要將動(dòng)畫加入了一個(gè)layer,layer便立即進(jìn)入動(dòng)畫的初始狀態(tài)。因?yàn)橛锌赡艹霈F(xiàn)fromValue不是目前l(fā)ayer的初始狀態(tài)的情況,如果fromValue就是layer當(dāng)前的狀態(tài),則這個(gè)參數(shù)就沒太大意義。
kCAFillModeBoth
理解了上面兩個(gè),這個(gè)就很好理解了,這個(gè)其實(shí)就是上面兩個(gè)的合成.動(dòng)畫加入后開始之前,layer便處于動(dòng)畫初始狀態(tài),動(dòng)畫結(jié)束后layer保持動(dòng)畫最后的狀態(tài).
注意點(diǎn)3
[self.view.layer addAnimation:positionAnima forKey:@"AnimationMoveY"];
我們可以根據(jù)這個(gè)Key找到這個(gè)layer
注意點(diǎn)4:一些常用的屬性
我們做一個(gè)心跳的效果
代碼
//初始化CALayer
CALayer *layer = [[CALayer alloc]init];
layer.backgroundColor = [UIColor redColor].CGColor;
layer.frame = CGRectMake(100, 100, 100, 100);
layer.cornerRadius = 10;
[self.view.layer addSublayer:layer];
//配置CABasicAnimation
CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
basicAnimation.fromValue = [NSNumber numberWithFloat:1.0];
basicAnimation.toValue = [NSNumber numberWithFloat:1.5];
//當(dāng)動(dòng)畫執(zhí)行到toValue指定的狀態(tài)時(shí)是從toValue的狀態(tài)逆回去,還是直接跳到fromValue的狀態(tài)再執(zhí)行一遍
basicAnimation.autoreverses = YES;
basicAnimation.removedOnCompletion = NO;
basicAnimation.duration = 0.5;
basicAnimation.repeatCount = MAXFLOAT;
//把動(dòng)畫內(nèi)容添加到layer上
[layer addAnimation:basicAnimation forKey:@"basicAnimation"];
關(guān)鍵幀動(dòng)畫(CAKeyFrameAnimation)
CABasicAnimation只能從一個(gè)數(shù)值(fromValue)變到另一個(gè)數(shù)值(toValue),而CAKeyframeAnimation會(huì)使用一個(gè)NSArray保存這些數(shù)值
屬性介紹
values:就是上述的NSArray對(duì)象。里面的元素稱為”關(guān)鍵幀”(keyframe)。動(dòng)畫對(duì)象會(huì)在指定的時(shí)間(duration)內(nèi),依次顯示values數(shù)組中的每一個(gè)關(guān)鍵幀
path:可以設(shè)置一個(gè)CGPathRef\CGMutablePathRef,讓層跟著路徑移動(dòng)。path只對(duì)CALayer的anchorPoint和position起作用。如果你設(shè)置了path,那么values將被忽略
keyTimes:可以為對(duì)應(yīng)的關(guān)鍵幀指定對(duì)應(yīng)的時(shí)間點(diǎn),其取值范圍為0到1.0,keyTimes中的每一個(gè)時(shí)間值都對(duì)應(yīng)values中的每一幀.當(dāng)keyTimes沒有設(shè)置的時(shí)候,各個(gè)關(guān)鍵幀的時(shí)間是平分的
value方式代碼
//創(chuàng)建動(dòng)畫對(duì)象
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
//設(shè)置value
NSValue *value1=[NSValue valueWithCGPoint:CGPointMake(100, 100)];
NSValue *value2=[NSValue valueWithCGPoint:CGPointMake(200, 100)];
NSValue *value3=[NSValue valueWithCGPoint:CGPointMake(200, 200)];
NSValue *value4=[NSValue valueWithCGPoint:CGPointMake(100, 200)];
NSValue *value5=[NSValue valueWithCGPoint:CGPointMake(100, 300)];
NSValue *value6=[NSValue valueWithCGPoint:CGPointMake(200, 400)];
animation.values=@[value1,value2,value3,value4,value5,value6];
//重復(fù)次數(shù) 默認(rèn)為1
animation.repeatCount=MAXFLOAT;
//設(shè)置是否原路返回默認(rèn)為不
animation.autoreverses = YES;
//設(shè)置移動(dòng)速度,越小越快
animation.duration = 4.0f;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
//給這個(gè)view加上動(dòng)畫效果
[_keyFrameView.layer addAnimation:animation forKey:nil];
path方法代碼
CAKeyframeAnimation *anima = [CAKeyframeAnimation animationWithKeyPath:@"position"];
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(100, 100)];
[path addLineToPoint:CGPointMake(150, 150)];
[path addLineToPoint:CGPointMake(100, 200)];
[path addLineToPoint:CGPointMake(50, 150)];
anima.path = path.CGPath;
anima.duration = 2.0f;
anima.repeatCount= MAXFLOAT;
anima.autoreverses = NO;
anima.removedOnCompletion = NO;
anima.fillMode = kCAFillModeForwards;
[_keyFrameView.layer addAnimation:anima forKey:@"pathAnimation"];
動(dòng)畫組動(dòng)畫(CAAnimationGroup)
動(dòng)畫組(CAAnimationGroup)是核心動(dòng)畫中又一個(gè)比較重要的知識(shí)點(diǎn)。動(dòng)畫組顧名思義就是一組動(dòng)畫,它可以將多個(gè)動(dòng)畫對(duì)象保存起來,然后再將其添加到layer上,讓組中所有的動(dòng)畫對(duì)象同時(shí)并發(fā)執(zhí)行。
/****************** 創(chuàng)建平移動(dòng)畫 ******************/
CABasicAnimation *basicAnim = [CABasicAnimation animation];
// 設(shè)置動(dòng)畫屬性
basicAnim.keyPath = @"position.y";
basicAnim.toValue = @350;
/****************** 創(chuàng)建縮放動(dòng)畫 ******************/
CABasicAnimation *scaleAnim = [CABasicAnimation animation];
// 設(shè)置動(dòng)畫屬性
scaleAnim.keyPath = @"transform.scale";
scaleAnim.toValue = @0.5;
;
/****************** 創(chuàng)建動(dòng)畫組 ******************/
CAAnimationGroup *groupAnim = [CAAnimationGroup animation];
// 將動(dòng)畫對(duì)象都添加到CAAnimationGroup對(duì)象中
groupAnim.animations = @[basicAnim, scaleAnim];
/****************** 通過動(dòng)畫組對(duì)象統(tǒng)一設(shè)置動(dòng)畫屬性和狀態(tài) ******************/
// 設(shè)置動(dòng)畫的執(zhí)行時(shí)長
groupAnim.duration = 0.5;
// 動(dòng)畫完成時(shí)保持在最新的狀態(tài)
groupAnim.removedOnCompletion = NO;
groupAnim.fillMode = kCAFillModeForwards;
groupAnim.duration = 2.0f;
groupAnim.repeatCount= MAXFLOAT;
groupAnim.autoreverses = YES;
groupAnim.removedOnCompletion = NO;
groupAnim.fillMode = kCAFillModeForwards;
/****************** 將動(dòng)畫組對(duì)象添加到redView的layer上 ******************/
[_animationGroupView.layer addAnimation:groupAnim forKey:nil];
轉(zhuǎn)場(chǎng)動(dòng)畫(CATranstion)
CATransition是CAAnimation的子類,用于做轉(zhuǎn)場(chǎng)動(dòng)畫,能夠?yàn)閷犹峁┮瞥銎聊缓鸵迫肫聊坏膭?dòng)畫效果。iOS比Mac OS X的轉(zhuǎn)場(chǎng)動(dòng)畫效果少一點(diǎn)
UINavigationController就是通過CATransition實(shí)現(xiàn)了將控制器的視圖推入屏幕的動(dòng)畫效果
動(dòng)畫屬性:
type:動(dòng)畫過渡類型
subtype:動(dòng)畫過渡方向
startProgress:動(dòng)畫起點(diǎn)(在整體動(dòng)畫的百分比)
endProgress:動(dòng)畫終點(diǎn)(在整體動(dòng)畫的百分比)