日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

走进 Facebook POP 的世界

發布時間:2025/6/17 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 走进 Facebook POP 的世界 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

?

POP: 一個流行的可擴展的動畫引擎iOS,它支持spring和衰變動態動畫,使其可用于構建現實,基于物理交互。Objective - C API允許快速集成, 對于所有的動畫和過渡他是成熟的.

?

解釋:

1.1 POP 使用 Objective-C++ 編寫,Objective-C++ 是對 C++ 的擴展,就像 Objective-C 是 C 的擴展。而至于為什么他們用 Objective-C++ 而不是純粹的 Objective-C. 可能是偏愛。-.O

1.2 POP 目前由四部分組成:1. Animations;2. Engine;3. Utility;4. WebCore。下圖有助于你更好的理解它的架構

?

?

1.它支持CocoaPods 你可以這樣

?

pod 'pop', '~> 1.0.8'

?

2.或者這樣點擊下載拉入工程 https://github.com/facebook/pop

?

3.我使用的Cocoapods 所以使用之前你需要這樣

?

#import <POP.h>

?

動圖

?

E1:

?

- (void)clickPopAction

{

????// kPOPLayerPositionY 向下

????// kPOPLayerPositionX 向右

????POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerPositionY];

????// 移動距離

????anim.toValue = [[NSNumber alloc] initWithFloat:_btnPop.center.y + 200];

????// 從當前 + 1s后開始

????anim.beginTime = CACurrentMediaTime() + 1.0f;

????// 彈力--晃動的幅度 (springSpeed速度)

????anim.springBounciness = 15.0f;

????[_btnPop pop_addAnimation:anim forKey:@"position"];

????POPSpringAnimation *anim1 = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];

????anim1.toValue = [NSValue valueWithCGRect:CGRectMake(100, 100, 99, 99)];

????[_btnPop pop_addAnimation:anim1 forKey:@"size"];

}

?

動圖

?

E2:在很多金融類app中比較常見、支付寶中的余額包、京東金融余額、就類似這樣

?

// 初始化

????POPBasicAnimation *anim = [POPBasicAnimation animation];

????// 限時 1s

????anim.duration = 3.0;

????POPAnimatableProperty * prop = [POPAnimatableProperty propertyWithName:@"count++" initializer:^(POPMutableAnimatableProperty *prop) {

????????prop.readBlock = ^(id obj, CGFloat values[]){ values[0] = [[obj description] floatValue]; };

????????prop.writeBlock = ^(id obj, const CGFloat values[])

????????{

????????????[obj setText:[NSString stringWithFormat:@"%.2f",values[0]]];

????????};

????????prop.threshold = 0.01;

????}];

?

????anim.property = prop;

????anim.fromValue = @(0.0);

????anim.toValue = @(1314.52);

????[self.xt_countLabel pop_addAnimation:anim forKey:@"counting"];

?

動圖

?

E3

?

CALayer *layer0 = [CALayer layer];

????layer0.opacity = 1.0;

????layer0.transform = CATransform3DIdentity;

????[layer0 setMasksToBounds:YES];

????[layer0 setBackgroundColor:[UIColor colorWithRed:0.5448 green:0.6836 blue:0.9986 alpha:1.0].CGColor];

????[layer0 setCornerRadius:12.5];

????[layer0 setBounds:CGRectMake(0, 0, 25, 25)];

????[self.view.layer addSublayer:layer0];

????layer0.position = CGPointMake(self.view.center.x, 266);

????[self performAnimation:layer0];

?

- (void)performAnimation:(CALayer *)layer

{

????[layer pop_removeAllAnimations];

????POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerScaleXY];

????static BOOL ani = YES;

????if (ani) {

????????anim.toValue = [NSValue valueWithCGPoint:CGPointMake(1.0, 1.0)];

????}else{

????????anim.toValue = [NSValue valueWithCGPoint:CGPointMake(1.5, 1.5)];

????}

????ani = !ani;

????anim.completionBlock = ^(POPAnimation *anim, BOOL finished) {

????????if (finished) { [self performAnimation:layer]; }

????};

????[layer pop_addAnimation:anim forKey:@"Animation"];

}

轉載于:https://www.cnblogs.com/fengmin/p/5599531.html

總結

以上是生活随笔為你收集整理的走进 Facebook POP 的世界的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。