欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

怎么在iOS中添加一個(gè)購物車動(dòng)畫效果-創(chuàng)新互聯(lián)

怎么在iOS中添加一個(gè)購物車動(dòng)畫效果?相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。

在平城等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供做網(wǎng)站、網(wǎng)站設(shè)計(jì) 網(wǎng)站設(shè)計(jì)制作按需定制,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站制作,成都全網(wǎng)營(yíng)銷,成都外貿(mào)網(wǎng)站建設(shè),平城網(wǎng)站建設(shè)費(fèi)用合理。

一、計(jì)算動(dòng)畫開始結(jié)束點(diǎn)位置

方法:

- (CGPoint)convertPoint:(CGPoint)point toView:(nullable UIView *)view;

1) 動(dòng)畫開始位置fromCenter

復(fù)制代碼 代碼如下:


CGPoint fromCenter =  [animationView convertPoint:CGPointMake(animationView.frame.size.width * 0.5f, animationView.frame.size.height * 0.5f) toView:keyWindow];

2)動(dòng)畫結(jié)束位置endCenter

復(fù)制代碼 代碼如下:


CGPoint endCenter = [endView convertPoint:CGPointMake(endView.frame.size.width * 0.5f, endView.frame.size.height * 0.5f) toView:keyWindow];

二、計(jì)算貝塞爾曲線(拋物線)的兩個(gè)控制點(diǎn)

怎么在iOS中添加一個(gè)購物車動(dòng)畫效果

  • controlPoint1是控制點(diǎn)1

  • controlPoint2是控制點(diǎn)2

  • A是controlPoint1和controlPoint2的中點(diǎn)

  • controlPointC是fromCenter和B的中點(diǎn)

1)先設(shè)置控制點(diǎn)距最高點(diǎn)(fromCenter或endCenter)的水平距離controlPointEY,本篇默認(rèn)controlPointEY = 100,即圖1中點(diǎn)controlPointC到點(diǎn)A的距離。

2)計(jì)算控制點(diǎn)相對(duì)于點(diǎn)A的距離controlPointEX,即controlPoint1到A距離或controlPoint2到A距離,本篇設(shè)置為fromCenter.x到endCenter.x的1/4,即controlPointEX = (endCenter.x - fromCenter.x) * 0.25f;

3)計(jì)算兩個(gè)控制點(diǎn)

CGPoint controlPoint1 = CGPointMake(controlPointCX - controlPointEX, controlPointCY - controlPointEY);
CGPoint controlPoint2 = CGPointMake(controlPointCX + controlPointEX, controlPointCY - controlPointEY);

三、復(fù)制動(dòng)畫的layer

NSString *str = ((UIButton *)animationView).titleLabel.text;
_animationLayer = [CATextLayer layer];
_animationLayer.bounds = animationView.bounds;
_animationLayer.position = fromCenter;
_animationLayer.alignmentMode = kCAAlignmentCenter;//文字對(duì)齊方式
_animationLayer.wrapped = YES;
_animationLayer.contentsScale = [UIScreen mainScreen].scale;
_animationLayer.string = str;
_animationLayer.backgroundColor = [UIColor redColor].CGColor;
[keyWindow.layer addSublayer:_animationLayer];

四、動(dòng)畫組合

1)運(yùn)動(dòng)軌跡(拋物線)

UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:fromCenter];
[path addCurveToPoint:endCenter controlPoint1:controlPoint1 controlPoint2:controlPoint2];
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.path = path.CGPath;

2)旋轉(zhuǎn)起來

CABasicAnimation *rotateAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotateAnimation.removedOnCompletion = YES;
rotateAnimation.fromValue = [NSNumber numberWithFloat:0];
rotateAnimation.toValue = [NSNumber numberWithFloat:10 * M_PI];
rotateAnimation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]

3)縮放動(dòng)畫

CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.removedOnCompletion = NO;
scaleAnimation.fromValue = [NSNumber numberWithFloat:1.0];
scaleAnimation.toValue = [NSNumber numberWithFloat:0.2];

4)透明度動(dòng)畫

CABasicAnimation *alphaAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
alphaAnimation.removedOnCompletion = NO;
alphaAnimation.fromValue = [NSNumber numberWithFloat:1.0];
alphaAnimation.toValue = [NSNumber numberWithFloat:0.1];

5)動(dòng)畫組合

CAAnimationGroup *groups = [CAAnimationGroup animation];
groups.animations = @[pathAnimation,rotateAnimation, scaleAnimation, alphaAnimation];
groups.duration = kShoppingCartDuration;
groups.removedOnCompletion=NO;
groups.fillMode=kCAFillModeForwards;
groups.delegate = self;
[_animationLayer addAnimation:groups forKey:@"group"];

看完上述內(nèi)容,你們掌握怎么在iOS中添加一個(gè)購物車動(dòng)畫效果的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司行業(yè)資訊頻道,感謝各位的閱讀!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)建站www.aaarwkj.com,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

本文標(biāo)題:怎么在iOS中添加一個(gè)購物車動(dòng)畫效果-創(chuàng)新互聯(lián)
鏈接URL:http://www.aaarwkj.com/article4/jccie.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、建站公司、自適應(yīng)網(wǎng)站、云服務(wù)器微信公眾號(hào)、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計(jì)
青青草国产自拍在线视频 | 欧美在线免费黄片视频| 免费在线观看做性小视频| 日韩无砖区2021不卡| 欧美老熟妇子乱视频在线| 91香蕉伊人综合久久麻豆| 81精品国产综合久久精品伦理| 精品熟妇人妻一区二区三区| 蜜桃视频在线观看视频免费| 国产日韩欧美在线精品| 久久精品人妻麻豆尤物| 中文免费在线观看av| 午夜香蕉av一区二区三区| 日本视频三区在线播放| 热久久青草精品欧美一区| 蜜臀99久久精品久久久| 日本h电影一区二区三区| 国产精品一区二区久久蜜桃麻豆 | 一二区中文字幕在线观看| 黄色录像一级二级三级| 成年人午夜看片免费网站| 色呦呦视频在线免费看| 99久久婷婷免费国产综合精品| 欧美性极品少妇精品网站| 国产伦理免费精品中文字幕| 日韩中文字幕一二一二区| 欧美一区二区三区成人网| 日韩人成理论午夜福利| 91大片在线观看视频| 亚洲av成人永久网站一区| 不卡的av中文字幕在线播放| 日韩精品免费一区二区三区| 99久久精品免费国产一区| 亚洲品质一区二区三区| 午夜影院免费在线观看五分钟 | 丰满多毛熟妇的大阴户| 亚洲综合中文字幕日韩| 国产国产乱老熟女视频网站| 99久在线观看精品视频| 欧美亚洲另类色自拍偷拍| 青青草成人一区二区三区|