文章来源:淘论文网   发布者: 毕业设计   浏览量: 25



还可以点击去查询以下关键词:
[动画]    [知识]    [运用]    [常见]    [效果]    [收集]    [动画知识运用及常见动画效果收集]   

项目介绍:

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 basicAnimation.name=@'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 AnimationPOPBasicAnimationPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; // kCAMediaTimingFunctionLinear kCAMediaTimingFunctionEaseIn kCAMediaTimingFunctionEaseOut kCAMediaTimingFunctionEaseInEaseOutPOPSpringAnimationPOPSpringAnimation *springAnimation = [POPSpringAnimation animation]; springAnimation.velocity=@(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 4POPDecayAnimationPOPDecayAnimation *decayAnimation=[POPDecayAnimation animation]; decayAnimation.velocity=@(233); //change of value units per second decayAnimation.deceleration=.833; //range of 0 to 1ExamplePOPBasicAnimation *basicAnimation = [POPBasicAnimation animation];Step 2 Decide if you will animate a view property or layer propertyView PropertiesAlpha - kPOPViewAlphaColor - kPOPViewBackgroundColorSize - kPOPViewBoundsCenter - kPOPViewCenterLocation & Size - kPOPViewFrameSize - kPOPViewScaleXYSize(Scale) - kPOPViewSizeLayer PropertiesColor - kPOPLayerBackgroundColorSize - kPOPLayerBoundsSize - kPOPLayerScaleXYSize - kPOPLayerSizeOpacity - kPOPLayerOpacityPosition - kPOPLayerPositionX Position - kPOPLayerPositionXY Position - kPOPLayerPositionYRotation - kPOPLayerRotationColor - kPOPLayerBackgroundColorExamplePOPBasicAnimation *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 | UITableViewStep 3 Find your property below then add and set .toValueView PropertiesAlpha - kPOPViewAlphaPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewAlpha]; basicAnimation.toValue= @(0); // scale from 0 to 1Color - kPOPViewBackgroundColorPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPViewBackgroundColor]; basicAnimation.toValue= [UIColor redColor];Size - kPOPViewBoundsPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewBounds]; basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)]; //first 2 values dont matterCenter - kPOPViewCenterPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewCenter]; basicAnimation.toValue=[NSValue valueWithCGPoint:CGPointMake(200, 200)];Location & Size - kPOPViewFramePOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame]; basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(140, 140, 140, 140)];Size - kPOPViewScaleXYPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewScaleXY]; basicAnimation.toValue=[NSValue valueWithCGSize:CGSizeMake(3, 2)];Size(Scale) - kPOPViewSizePOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewSize]; basicAnimation.toValue=[NSValue valueWithCGSize:CGSizeMake(30, 200)];Layer PropertiesColor - kPOPLayerBackgroundColorPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerBackgroundColor]; basicAnimation.toValue= [UIColor redColor];Size - kPOPLayerBoundsPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerBounds]; basicAnimation.toValue= [NSValue valueWithCGRect:CGRectMake(0, 0, 90, 90)]; //first 2 values dont matterSize - kPOPLayerScaleXYPOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerScaleXY]; basicAnimation.toValue= [NSValue valueWithCGSize:CGSizeMake(2, 1)];//increases width and height scalesSize - kPOPLayerSizePOPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPLayerSize]; basicAnimation.toValue= [NSValue valueWithCGSize:CGSizeMake(200, 200)];Opacity - kPOPLayerOpacityPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerOpacity]; basicAnimation.toValue = @(0);Position - kPOPLayerPositionPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerPosition]; basicAnimation.toValue= [NSValue valueWithCGRect:CGRectMake(130, 130, 0, 0)];//last 2 values dont matterX Position - kPOPLayerPositionXPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerPositionX]; basicAnimation.toValue= @(240);Y Position - kPOPLayerPositionYPOPSpringAnimation *anim = [POPSpringAnimation animation]; anim.property=[POPAnimatableProperty propertyWithName:kPOPLayerPositionY]; anim.toValue = @(320);Rotation - kPOPLayerRotationPOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerRotation]; basicAnimation.toValue= @(M_PI/4); //2 M_PI is an entire rotationNote: Property Changes work for all 3 animation types - POPBasicAnimation POPSpringAnimation POPDecayAnimationExamplePOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName: kPOPLayerRotation]; basicAnimation.toValue= @(M_PI/4); //2 M_PI is an entire rotationStep 4 Create Name & Delegate For AnimationbasicAnimation.name=@'WhatEverAnimationNameYouWant'; basicAnimation.delegate=self;Declare Delegate Protocol <POPAnimatorDelegate>Delegate Methods#p#分页标题#e#

`
<POPAnimatorDelegate>
`

- (void)pop_animationDidStart:(POPAnimation *)anim;- (void)pop_animationDidStop:(POPAnimation *)anim finished:(BOOL)finished;- (void)pop_animationDidReachToValue:(POPAnimation *)anim;ExamplePOPSpringAnimation *basicAnimation = [POPSpringAnimation animation]; basicAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame]; basicAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)]; basicAnimation.name=@'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)]; basicAnimation.name=@'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!'); //加入新的动画 }};#p#分页标题#e#

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



github地址:
https://github.com/wujunyang/facebookPopTest


这里还有:


还可以点击去查询:
[动画]    [知识]    [运用]    [常见]    [效果]    [收集]    [动画知识运用及常见动画效果收集]   

请扫码加微信 微信号:sj52abcd


下载地址: http://www.taolw.com/down/7357.docx
  • 上一篇:ReactiveCocoa知识点运用及结合毕业设计MVVM实例并简单包含单元测试知识
  • 下一篇:swift3.1写的定制微信界面