zoukankan      html  css  js  c++  java
  • iphone中CABasicAnimation和UIView动画的区别[转]

    关于UIView动画:

    1. [UIView beginAnimations:@"zoom out" context:nil];
    2. [UIView setAnimationDuration:1.f];
    3. [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    4. cover.transform = CGAffineTransformMakeScale(9.25,7.05);
    5. cover.center = CGPointMake(430512);
    6. [UIView commitAnimations]

    UIView动画是应用在一个view上面的。

    关于CABasicAnimation动画:

    1. - (CAAnimation *)animationMove:(CGPoint)rootCenter
    2. {
    3.     CABasicAnimation *animationMove
    4.     = [CABasicAnimation animationWithKeyPath:@"position"];
    5.     animationMove.duration = 1;
    6.     animationMove.autoreverses = NO;
    7. //    animationMove.delegate = self;
    8.     animationMove.removedOnCompletion = NO;
    9.     animationMove.fillMode = kCAFillModeForwards;
    10.     animationMove.fromValue = [NSValue valueWithCGPoint:self.oldCoverCenter];
    11.     animationMove.toValue =[NSValue valueWithCGPoint:rootCenter];
    12.  
    13.     return animationMove;
    14. }

    CABasicAnimation动画是应用在一个layer上面的。

    注:
    1,把一个image放在一个view的layer上来放大的时候,如果用UIView来做,图片不会太多的失真和闪烁的效果,但是用CABasicAnimation来做失真和闪烁现象会很严重,效果很不好。
    2,做 动画的叠加效果 很简单,只要把各自的动画放在一起就可以了。请看这个效果:一本书边移动到屏幕中间,边放大,边打开封面的效果。

    1. [imageLayer addAnimation:[self animationOpen] forKey:@"Open"];
    2. [UIView beginAnimations:@"zoom out" context:nil];
    3. [UIView setAnimationDuration:1.f];
    4. [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    5. cover.transform = CGAffineTransformMakeScale(5.5,5.5);
    6. cover.center = CGPointMake(629384);
    7. [UIView commitAnimations];
    8.  
    9. - (CAAnimation *)animationOpen
    10. {
    11.     CABasicAnimation *animationOpen
    12.     = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
    13.     animationOpen.duration = 1;
    14.     animationOpen.autoreverses = NO;
    15.     animationOpen.delegate = self;  //然后执行真正地打开书的内容
    16.     animationOpen.removedOnCompletion = NO;
    17.     animationOpen.fillMode = kCAFillModeForwards;
    18.     animationOpen.fromValue = [NSNumber numberWithFloat:-M_PI/5];
    19.     animationOpen.toValue = [NSNumber numberWithFloat:-M_PI/1.5];
    20.  
    21.     return animationOpen;
    22. }
  • 相关阅读:
    拆分字符串为单条记录
    Howto: Change Windows Hostname and Keep Oracle 10g Running
    关于Oracle的MTS
    linux/centos Header V3 DSA signature: NOKEY, key ID 错误解决方法
    cacti0.8.7d安装
    Identifying Host Names and IP Addresses
    修改Oracle字符集(character set)
    企业管理器(OEM)介绍: Grid Control 和 Database Control
    搞OMS真折腾
    ORA12560: TNS: 协议适配器错误
  • 原文地址:https://www.cnblogs.com/bandy/p/2418358.html
Copyright © 2011-2022 走看看