日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

走进 Facebook POP 的世界

發(fā)布時(shí)間:2025/6/17 54 豆豆
生活随笔 收集整理的這篇文章主要介紹了 走进 Facebook POP 的世界 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?

?

POP: 一個(gè)流行的可擴(kuò)展的動(dòng)畫引擎iOS,它支持spring和衰變動(dòng)態(tài)動(dòng)畫,使其可用于構(gòu)建現(xiàn)實(shí),基于物理交互。Objective - C API允許快速集成, 對(duì)于所有的動(dòng)畫和過(guò)渡他是成熟的.

?

解釋:

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

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

?

?

1.它支持CocoaPods 你可以這樣

?

pod 'pop', '~> 1.0.8'

?

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

?

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

?

#import <POP.h>

?

動(dòng)圖

?

E1:

?

- (void)clickPopAction

{

????// kPOPLayerPositionY 向下

????// kPOPLayerPositionX 向右

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

????// 移動(dòng)距離

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

????// 從當(dāng)前 + 1s后開始

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

????// 彈力--晃動(dòng)的幅度 (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"];

}

?

動(dòng)圖

?

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

?

// 初始化

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

????// 限時(shí) 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"];

?

動(dòng)圖

?

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"];

}

轉(zhuǎn)載于:https://www.cnblogs.com/fengmin/p/5599531.html

總結(jié)

以上是生活随笔為你收集整理的走进 Facebook POP 的世界的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。