{"id":21654501,"url":"https://github.com/wujunyang/facebookpoptest","last_synced_at":"2025-09-05T08:10:55.565Z","repository":{"id":94337963,"uuid":"51746087","full_name":"wujunyang/facebookPopTest","owner":"wujunyang","description":"动画实现的一些常见功能及实现方式，不断更新中....","archived":false,"fork":false,"pushed_at":"2018-11-30T08:22:46.000Z","size":3338,"stargazers_count":103,"open_issues_count":0,"forks_count":39,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T21:13:51.682Z","etag":null,"topics":["bezierpath","coreanimation","facebook-pop","objective-c"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wujunyang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-15T09:54:14.000Z","updated_at":"2024-02-27T06:19:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"f71d0dcc-fc24-4791-80d6-22777dcb8e44","html_url":"https://github.com/wujunyang/facebookPopTest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunyang%2FfacebookPopTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunyang%2FfacebookPopTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunyang%2FfacebookPopTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunyang%2FfacebookPopTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wujunyang","download_url":"https://codeload.github.com/wujunyang/facebookPopTest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480427,"owners_count":21110937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bezierpath","coreanimation","facebook-pop","objective-c"],"created_at":"2024-11-25T08:28:04.212Z","updated_at":"2025-04-11T21:13:56.678Z","avatar_url":"https://github.com/wujunyang.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# facebookPopTest\n关于facebook开源动画库Pop的练习实例\n\n\n### 运行效果图\n\n\u003cimg src=\"https://github.com/wujunyang/facebookPopTest/blob/master/1.gif\" width=400px height=600px\u003e\u003c/img\u003e\n\n\n### 一：关于Poping一些使用知识点\n\n#### 5 使用Poping只要简单五步就可以实现\n\n```objective-c\n  // 1. Pick a Kind Of Animation //  POPBasicAnimation  POPSpringAnimation POPDecayAnimation\n  POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\n\n  // 2. Decide weather you will animate a view property or layer property, Lets pick a View Property and pick kPOPViewFrame\n  // View Properties - kPOPViewAlpha kPOPViewBackgroundColor kPOPViewBounds kPOPViewCenter kPOPViewFrame kPOPViewScaleXY kPOPViewSize\n  // Layer Properties - kPOPLayerBackgroundColor kPOPLayerBounds kPOPLayerScaleXY kPOPLayerSize kPOPLayerOpacity kPOPLayerPosition kPOPLayerPositionX kPOPLayerPositionY kPOPLayerRotation kPOPLayerBackgroundColor\n  basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];\n\n  // 3. Figure Out which of 3 ways to set toValue\n   //  anim.toValue = @(1.0);\n  //  anim.toValue =  [NSValue valueWithCGRect:CGRectMake(0, 0, 400, 400)];\n  //  anim.toValue =  [NSValue valueWithCGSize:CGSizeMake(40, 40)];\n  basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)];\n\n  // 4. Create Name For Animation \u0026 Set Delegate\n   basicAnimation.name=@\"AnyAnimationNameYouWant\";\n   basicAnimation.delegate=self\n\n  // 5. Add animation to View or Layer, we picked View so self.tableView and not layer which would have been self.tableView.layer\n  [self.tableView pop_addAnimation:basicAnimation forKey:@\"WhatEverNameYouWant\"];\n```\n\n\n\n#### Step 1 Pick Kind of Animation\n\n\n### POPBasicAnimation\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];\n// kCAMediaTimingFunctionLinear  kCAMediaTimingFunctionEaseIn  kCAMediaTimingFunctionEaseOut  kCAMediaTimingFunctionEaseInEaseOut\n```\n\n### POPSpringAnimation\n```objective-c\nPOPSpringAnimation *springAnimation = [POPSpringAnimation animation];\nspringAnimation.velocity=@(1000);       // change of value units per second\nspringAnimation.springBounciness=14;    // value between 0-20 default at 4\nspringAnimation.springSpeed=3;     // value between 0-20 default at 4\n```\n\n### POPDecayAnimation\n```objective-c\nPOPDecayAnimation *decayAnimation=[POPDecayAnimation animation];\ndecayAnimation.velocity=@(233); //change of value units per second\ndecayAnimation.deceleration=.833; //range of 0 to 1\n```\n\n### Example\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\n```\n\n\n#### Step 2 Decide if you will animate a view property or layer property\n\n### View Properties\n##### Alpha - kPOPViewAlpha\n##### Color - kPOPViewBackgroundColor\n##### Size - kPOPViewBounds\n##### Center - kPOPViewCenter\n##### Location \u0026 Size - kPOPViewFrame\n##### Size - kPOPViewScaleXY\n##### Size(Scale) - kPOPViewSize\n\n\n### Layer Properties\n##### Color - kPOPLayerBackgroundColor\n##### Size - kPOPLayerBounds\n##### Size - kPOPLayerScaleXY\n##### Size - kPOPLayerSize\n##### Opacity - kPOPLayerOpacity\n##### Position - kPOPLayerPosition\n##### X Position - kPOPLayerPositionX\n##### Y Position - kPOPLayerPositionY\n##### Rotation - kPOPLayerRotation\n##### Color - kPOPLayerBackgroundColor\n\n### Example\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\n```\n\n#### Note: Works on any Layer property or any object that inherits from UIView such as UIToolbar | UIPickerView | UIDatePicker | UIScrollView |  UITextView | UIImageView | UITableViewCell | UIStepper | UIProgressView | UIActivityIndicatorView | UISwitch | UISlider | UITextField | UISegmentedControl | UIButton | UIView | UITableView\n\n\n\n#### Step 3 Find your property below then add and set .toValue\n\n### View Properties\n##### Alpha - kPOPViewAlpha\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewAlpha];\nbasicAnimation.toValue= @(0); // scale from 0 to 1\n```\n\n##### Color - kPOPViewBackgroundColor\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPViewBackgroundColor];\nbasicAnimation.toValue= [UIColor redColor];\n```\n\n##### Size - kPOPViewBounds\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewBounds];\nbasicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)]; //first 2 values dont matter\n```\n\n##### Center - kPOPViewCenter\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewCenter];\nbasicAnimation.toValue=[NSValue valueWithCGPoint:CGPointMake(200, 200)];\n```\n\n##### Location \u0026 Size - kPOPViewFrame\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];\nbasicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(140, 140, 140, 140)];\n```\n\n##### Size - kPOPViewScaleXY\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewScaleXY];\nbasicAnimation.toValue=[NSValue valueWithCGSize:CGSizeMake(3, 2)];\n```\n\n##### Size(Scale) - kPOPViewSize\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewSize];\nbasicAnimation.toValue=[NSValue valueWithCGSize:CGSizeMake(30, 200)];\n```\n### Layer Properties\n##### Color - kPOPLayerBackgroundColor\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerBackgroundColor];\nbasicAnimation.toValue= [UIColor redColor];\n```\n\n##### Size - kPOPLayerBounds\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerBounds];\nbasicAnimation.toValue= [NSValue valueWithCGRect:CGRectMake(0, 0, 90, 90)]; //first 2 values dont matter\n```\n\n##### Size - kPOPLayerScaleXY\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerScaleXY];\nbasicAnimation.toValue= [NSValue valueWithCGSize:CGSizeMake(2, 1)];//increases width and height scales\n```\n\n##### Size - kPOPLayerSize\n```objective-c\nPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPLayerSize];\nbasicAnimation.toValue= [NSValue valueWithCGSize:CGSizeMake(200, 200)];\n```\n\n##### Opacity - kPOPLayerOpacity\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerOpacity];\nbasicAnimation.toValue = @(0);\n```\n\n##### Position - kPOPLayerPosition\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerPosition];\nbasicAnimation.toValue= [NSValue valueWithCGRect:CGRectMake(130, 130, 0, 0)];//last 2 values dont matter\n```\n\n##### X Position - kPOPLayerPositionX\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerPositionX];\nbasicAnimation.toValue= @(240);\n```\n\n##### Y Position - kPOPLayerPositionY\n```objective-c\nPOPSpringAnimation *anim = [POPSpringAnimation animation];\nanim.property=[POPAnimatableProperty propertyWithName:kPOPLayerPositionY];\nanim.toValue = @(320);\n```\n\n##### Rotation - kPOPLayerRotation\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerRotation];\nbasicAnimation.toValue= @(M_PI/4); //2 M_PI is an entire rotation\n```\n#### Note: Property Changes work for all 3 animation types - POPBasicAnimation POPSpringAnimation POPDecayAnimation\n### Example\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerRotation];\nbasicAnimation.toValue= @(M_PI/4); //2 M_PI is an entire rotation\n```\n\n#### Step 4 Create Name \u0026 Delegate For Animation\n```objective-c\nbasicAnimation.name=@\"WhatEverAnimationNameYouWant\";\nbasicAnimation.delegate=self;\n```\n##### Declare Delegate Protocol `\u003cPOPAnimatorDelegate\u003e`\n\n### Delegate Methods\n`\n\u003cPOPAnimatorDelegate\u003e\n`\n```objective-c\n- (void)pop_animationDidStart:(POPAnimation *)anim;\n```\n```objective-c\n- (void)pop_animationDidStop:(POPAnimation *)anim finished:(BOOL)finished;\n```\n```objective-c\n- (void)pop_animationDidReachToValue:(POPAnimation *)anim;\n```\n\n\n### Example\n```objective-c\nPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\nbasicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];\nbasicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)];\nbasicAnimation.name=@\"WhatEverAnimationNameYouWant\";\nbasicAnimation.delegate=self;\n```\n\n\n#### Step 5 Add animation to View\n```objective-c\n [self.tableView pop_addAnimation:basicAnimation forKey:@\"WhatEverNameYouWant\"];\n```\n### Example\n```objective-c\n  POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];\n  basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];\n  basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)];\n  basicAnimation.name=@\"SomeAnimationNameYouChoose\";\n  basicAnimation.delegate=self;\n  [self.tableView pop_addAnimation:basicAnimation forKey:@\"WhatEverNameYouWant\"];\n```\n\n### 二：关于Poping一些注意点\n\n1：组动画的效果实现，同时写就会同时进行，就有组的效果\n\n```objective-c\n    POPSpringAnimation *Annimation1 = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY];\n    Annimation1.springSpeed = 40.0f;\n    Annimation1.springBounciness = 30.0f;\n    Annimation1.fromValue = [NSValue valueWithCGPoint:CGPointMake(0.3, 0.3)];\n    Annimation1.toValue = [NSValue valueWithCGPoint:CGPointMake(1, 1)];\n    POPSpringAnimation *Annimation2 = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];\n    Annimation2.springSpeed = 40.0f;\n    Annimation1.springBounciness = 30.0f;\n    Annimation2.toValue = [NSValue valueWithCGPoint:CGPointMake(100, 100)];\n    [_Subview pop_addAnimation:Annimation1 forKey:@\"Scale\"];\n    [_Subview pop_addAnimation:Annimation2 forKey:@\"Move\"];\n```\n\n2：关于连续动画的效果\n\n```objective-c\n anim.completionBlock = ^(POPAnimation *anim, BOOL finished) { \n  if (finished) {\n     NSLog(@\"Animation finished!\");\n     //加入新的动画\n     }};\n```\n\n3：可以实现委托POPAnimatorDelegate关于动画前后的一些操作处理\n\n```objective-c\n- (void)pop_animationDidStart:(POPAnimation *)anim;\n```\n```objective-c\n- (void)pop_animationDidStop:(POPAnimation *)anim finished:(BOOL)finished;\n```\n```objective-c\n- (void)pop_animationDidReachToValue:(POPAnimation *)anim;\n```\n\n4：POPBasicAnimation提供四种timingfunction(很熟悉，对不对? 就是Core Animation中那些)\n\n```objective-c\n\nkCAMediaTimingFunctionLinear\n\nkCAMediaTimingFunctionEaseIn\n\nkCAMediaTimingFunctionEaseOut\n\nkCAMediaTimingFunctionEaseInEaseOut\n\n```\n\n\n\u003cimg src=\"https://github.com/wujunyang/facebookPopTest/blob/master/2.png\" width=500px height=400px\u003e\u003c/img\u003e\n\n\u003cimg src=\"https://github.com/wujunyang/facebookPopTest/blob/master/3.png\" width=500px height=400px\u003e\u003c/img\u003e\n\n\u003cimg src=\"https://github.com/wujunyang/facebookPopTest/blob/master/4.png\" width=500px height=400px\u003e\u003c/img\u003e\n\n\u003cimg src=\"https://github.com/wujunyang/facebookPopTest/blob/master/5.png\" width=500px height=400px\u003e\u003c/img\u003e\n\n\n# 订阅号\n\n最近有个妹子弄的一个关于扩大眼界跟内含的订阅号，每天都会更新一些深度内容，在这里如果你感兴趣也可以关注一下(嘿对美女跟知识感兴趣)，当然可以关注后输入数字：5  会有我的微信号，如果有问题你也可以在那找到我；当然不感兴趣无视此信息；\n\n\n\u003cimg src=\"https://github.com/wujunyang/jiaModuleDemo/blob/master/jiaModuleDemo/ProjectImage/dy.jpg\" width=200px height=200px\u003e\u003c/img\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwujunyang%2Ffacebookpoptest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwujunyang%2Ffacebookpoptest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwujunyang%2Ffacebookpoptest/lists"}