All Projects → wujunyang → Facebookpoptest

wujunyang / Facebookpoptest

动画实现的一些常见功能及实现方式,不断更新中....

Projects that are alternatives of or similar to Facebookpoptest

FluentTransitions
▶ Smooth UI animations & transitions for .NET
Stars: ✭ 27 (-72.73%)
Mutual labels:  coreanimation
Anima
Anima is chainable Layer-Based Animation library for Swift5.
Stars: ✭ 504 (+409.09%)
Mutual labels:  coreanimation
Mystique
A wrapper for CoreAnimation.
Stars: ✭ 43 (-56.57%)
Mutual labels:  coreanimation
SHTransition
SHTransition is a simple library for viewcontroller transition animation in swift.
Stars: ✭ 35 (-64.65%)
Mutual labels:  coreanimation
Ttgemojirate
An emoji-liked rating view for iOS, implemented in Swift3.
Stars: ✭ 284 (+186.87%)
Mutual labels:  coreanimation
Flightanimator
Advanced Natural Motion Animations, Simple Blocks Based Syntax
Stars: ✭ 588 (+493.94%)
Mutual labels:  coreanimation
CircleFlow
CircleFlow is a project that revises Coverflow effect. Using Core Animation to build Coverflow-like effect but with a half-circle path
Stars: ✭ 39 (-60.61%)
Mutual labels:  coreanimation
Learniosanimations
Learn iOS Animations
Stars: ✭ 66 (-33.33%)
Mutual labels:  coreanimation
Stepslider
StepSlider its custom implementation of slider such as UISlider for preset integer values.
Stars: ✭ 391 (+294.95%)
Mutual labels:  coreanimation
Vktableview
Hi! I was working on an app where I had to show information about 10-12 different entities and each entity details are to be shown in a UICollectionView. Thought of adding some fancy element and I came up with this project. Would love your feedback. Please have a look at GIF attached to have a better idea of what I have come up with. Swift4.
Stars: ✭ 30 (-69.7%)
Mutual labels:  coreanimation
SwimplyPlayIndicator
Animated PlayIndicator written in SwiftUI. Inspired by Apple's Music Player.
Stars: ✭ 52 (-47.47%)
Mutual labels:  coreanimation
VKProgressHud
Hey All! As it is obvious from the GIF, this project is a LoadingIndicator based on CoreAnimation.
Stars: ✭ 30 (-69.7%)
Mutual labels:  coreanimation
Iosproject
iOS project of collected some demos for iOS App, use Objective-C
Stars: ✭ 5,357 (+5311.11%)
Mutual labels:  coreanimation
lotus
A Swift animation DSL for animating layers with help of CoreAnimation
Stars: ✭ 15 (-84.85%)
Mutual labels:  coreanimation
Vyplayindicator
PlayIndicator inspired by Apple's Music Player.
Stars: ✭ 47 (-52.53%)
Mutual labels:  coreanimation
UberAnimation
Heyaa! This is an attempt to mimic the animation Uber and Facebook shows up as a Congratulatory Pop-up. Looking at the attached GIF will give you a better idea of what this project covers. All written in Swift4.
Stars: ✭ 58 (-41.41%)
Mutual labels:  coreanimation
Pinterestsegment
A Pinterest-like segment control with masking animation.
Stars: ✭ 560 (+465.66%)
Mutual labels:  coreanimation
Tkrubberindicator
A rubber animation pagecontrol
Stars: ✭ 1,337 (+1250.51%)
Mutual labels:  coreanimation
Progressbutton
Custom ProgressButton
Stars: ✭ 52 (-47.47%)
Mutual labels:  coreanimation
Tkswitchercollection
An animation switch collection
Stars: ✭ 877 (+785.86%)
Mutual labels:  coreanimation

facebookPopTest

关于facebook开源动画库Pop的练习实例

运行效果图

一:关于Poping一些使用知识点

5 使用Poping只要简单五步就可以实现

  // 1. Pick a Kind Of Animation //  POPBasicAnimation  POPSpringAnimation POPDecayAnimation
  POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];

  // 2. Decide weather you will animate a view property or layer property, Lets pick a View Property and pick kPOPViewFrame
  // View Properties - kPOPViewAlpha kPOPViewBackgroundColor kPOPViewBounds kPOPViewCenter kPOPViewFrame kPOPViewScaleXY kPOPViewSize
  // Layer Properties - kPOPLayerBackgroundColor kPOPLayerBounds kPOPLayerScaleXY kPOPLayerSize kPOPLayerOpacity kPOPLayerPosition kPOPLayerPositionX kPOPLayerPositionY kPOPLayerRotation kPOPLayerBackgroundColor
  basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];

  // 3. Figure Out which of 3 ways to set toValue
   //  anim.toValue = @(1.0);
  //  anim.toValue =  [NSValue valueWithCGRect:CGRectMake(0, 0, 400, 400)];
  //  anim.toValue =  [NSValue valueWithCGSize:CGSizeMake(40, 40)];
  basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)];

  // 4. Create Name For Animation & Set Delegate
   [email protected]"AnyAnimationNameYouWant";
   basicAnimation.delegate=self

  // 5. Add animation to View or Layer, we picked View so self.tableView and not layer which would have been self.tableView.layer
  [self.tableView pop_addAnimation:basicAnimation forKey:@"WhatEverNameYouWant"];

Step 1 Pick Kind of Animation

POPBasicAnimation

POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
// kCAMediaTimingFunctionLinear  kCAMediaTimingFunctionEaseIn  kCAMediaTimingFunctionEaseOut  kCAMediaTimingFunctionEaseInEaseOut

POPSpringAnimation

POPSpringAnimation *springAnimation = [POPSpringAnimation animation];
[email protected](1000);       // change of value units per second
springAnimation.springBounciness=14;    // value between 0-20 default at 4
springAnimation.springSpeed=3;     // value between 0-20 default at 4

POPDecayAnimation

POPDecayAnimation *decayAnimation=[POPDecayAnimation animation];
[email protected](233); //change of value units per second
decayAnimation.deceleration=.833; //range of 0 to 1

Example

POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];

Step 2 Decide if you will animate a view property or layer property

View Properties

Alpha - kPOPViewAlpha
Color - kPOPViewBackgroundColor
Size - kPOPViewBounds
Center - kPOPViewCenter
Location & Size - kPOPViewFrame
Size - kPOPViewScaleXY
Size(Scale) - kPOPViewSize

Layer Properties

Color - kPOPLayerBackgroundColor
Size - kPOPLayerBounds
Size - kPOPLayerScaleXY
Size - kPOPLayerSize
Opacity - kPOPLayerOpacity
Position - kPOPLayerPosition
X Position - kPOPLayerPositionX
Y Position - kPOPLayerPositionY
Rotation - kPOPLayerRotation
Color - kPOPLayerBackgroundColor

Example

POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];

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

Step 3 Find your property below then add and set .toValue

View Properties

Alpha - kPOPViewAlpha
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewAlpha];
basicAnimation.toValue= @(0); // scale from 0 to 1
Color - kPOPViewBackgroundColor
POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPViewBackgroundColor];
basicAnimation.toValue= [UIColor redColor];
Size - kPOPViewBounds
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewBounds];
basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)]; //first 2 values dont matter
Center - kPOPViewCenter
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewCenter];
basicAnimation.toValue=[NSValue valueWithCGPoint:CGPointMake(200, 200)];
Location & Size - kPOPViewFrame
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];
basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(140, 140, 140, 140)];
Size - kPOPViewScaleXY
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewScaleXY];
basicAnimation.toValue=[NSValue valueWithCGSize:CGSizeMake(3, 2)];
Size(Scale) - kPOPViewSize
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewSize];
basicAnimation.toValue=[NSValue valueWithCGSize:CGSizeMake(30, 200)];

Layer Properties

Color - kPOPLayerBackgroundColor
POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerBackgroundColor];
basicAnimation.toValue= [UIColor redColor];
Size - kPOPLayerBounds
POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerBounds];
basicAnimation.toValue= [NSValue valueWithCGRect:CGRectMake(0, 0, 90, 90)]; //first 2 values dont matter
Size - kPOPLayerScaleXY
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerScaleXY];
basicAnimation.toValue= [NSValue valueWithCGSize:CGSizeMake(2, 1)];//increases width and height scales
Size - kPOPLayerSize
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPLayerSize];
basicAnimation.toValue= [NSValue valueWithCGSize:CGSizeMake(200, 200)];
Opacity - kPOPLayerOpacity
POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerOpacity];
basicAnimation.toValue = @(0);
Position - kPOPLayerPosition
POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerPosition];
basicAnimation.toValue= [NSValue valueWithCGRect:CGRectMake(130, 130, 0, 0)];//last 2 values dont matter
X Position - kPOPLayerPositionX
POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerPositionX];
basicAnimation.toValue= @(240);
Y Position - kPOPLayerPositionY
POPSpringAnimation *anim = [POPSpringAnimation animation];
anim.property=[POPAnimatableProperty propertyWithName:kPOPLayerPositionY];
anim.toValue = @(320);
Rotation - kPOPLayerRotation
POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerRotation];
basicAnimation.toValue= @(M_PI/4); //2 M_PI is an entire rotation

Note: Property Changes work for all 3 animation types - POPBasicAnimation POPSpringAnimation POPDecayAnimation

Example

POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerRotation];
basicAnimation.toValue= @(M_PI/4); //2 M_PI is an entire rotation

Step 4 Create Name & Delegate For Animation

[email protected]"WhatEverAnimationNameYouWant";
basicAnimation.delegate=self;
Declare Delegate Protocol <POPAnimatorDelegate>

Delegate Methods

<POPAnimatorDelegate>

- (void)pop_animationDidStart:(POPAnimation *)anim;
- (void)pop_animationDidStop:(POPAnimation *)anim finished:(BOOL)finished;
- (void)pop_animationDidReachToValue:(POPAnimation *)anim;

Example

POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];
basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)];
[email protected]"WhatEverAnimationNameYouWant";
basicAnimation.delegate=self;

Step 5 Add animation to View

 [self.tableView pop_addAnimation:basicAnimation forKey:@"WhatEverNameYouWant"];

Example

  POPSpringAnimation *basicAnimation = [POPSpringAnimation animation];
  basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];
  basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)];
  [email protected]"SomeAnimationNameYouChoose";
  basicAnimation.delegate=self;
  [self.tableView pop_addAnimation:basicAnimation forKey:@"WhatEverNameYouWant"];

二:关于Poping一些注意点

1:组动画的效果实现,同时写就会同时进行,就有组的效果

    POPSpringAnimation *Annimation1 = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY];
    Annimation1.springSpeed = 40.0f;
    Annimation1.springBounciness = 30.0f;
    Annimation1.fromValue = [NSValue valueWithCGPoint:CGPointMake(0.3, 0.3)];
    Annimation1.toValue = [NSValue valueWithCGPoint:CGPointMake(1, 1)];
    POPSpringAnimation *Annimation2 = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
    Annimation2.springSpeed = 40.0f;
    Annimation1.springBounciness = 30.0f;
    Annimation2.toValue = [NSValue valueWithCGPoint:CGPointMake(100, 100)];
    [_Subview pop_addAnimation:Annimation1 forKey:@"Scale"];
    [_Subview pop_addAnimation:Annimation2 forKey:@"Move"];

2:关于连续动画的效果

 anim.completionBlock = ^(POPAnimation *anim, BOOL finished) { 
  if (finished) {
     NSLog(@"Animation finished!");
     //加入新的动画
     }};

3:可以实现委托POPAnimatorDelegate关于动画前后的一些操作处理

- (void)pop_animationDidStart:(POPAnimation *)anim;
- (void)pop_animationDidStop:(POPAnimation *)anim finished:(BOOL)finished;
- (void)pop_animationDidReachToValue:(POPAnimation *)anim;

4:POPBasicAnimation提供四种timingfunction(很熟悉,对不对? 就是Core Animation中那些)


kCAMediaTimingFunctionLinear

kCAMediaTimingFunctionEaseIn

kCAMediaTimingFunctionEaseOut

kCAMediaTimingFunctionEaseInEaseOut

订阅号

最近有个妹子弄的一个关于扩大眼界跟内含的订阅号,每天都会更新一些深度内容,在这里如果你感兴趣也可以关注一下(嘿对美女跟知识感兴趣),当然可以关注后输入数字:5 会有我的微信号,如果有问题你也可以在那找到我;当然不感兴趣无视此信息;

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].