有关动画的code(2中 以后慢慢添加)

    


    //CABasicAnimation

    [blackView.layer addAnimation:[self opacityForever_Animation:3.0] forKey:@"key"];

    //UIView Animation

    [self animationRevealFromBotton:100];



    transform.scale.x 宽的比例转换

    transform.scale.y 高的比例转换

    transform.rotation.z 平面圆的旋转

    opacity 透明度

    margin 在视图中展示内容的大小

    zPosition 屏幕上层次的前后顺序

    backgroundColor 背景颜色

    cornerRadius 圆角

    borderWidth 边的宽度

    bounds layer的边界矩阵, frame类似contents 内容, 例如:图片的变化 contentsRect 内容可使用layer的大小frame 视图的frame矩阵hidden 隐藏状态 mask 遮挡背景和内容显示的透明度 masksToBounds 决定子layer是否从layer的边界中剪除position layer在其父layer中对应的位置shadowColor 阴影颜色shadowOffset 阴影偏移量shadowOpacity 阴影透明度shadowRadius 阴影圆角


- (CABasicAnimation *)opacityForever_Animation:(float)time

//永久闪烁的动画:渐变 

{

    //参数必须是layer的属性“属性”

    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"backgroundColor"];


//属性的值的变换

//    animation.fromValue=[NSNumber numberWithFloat:1.0];

//    animation.toValue=[NSNumber numberWithFloat:3.0];

//位置变换  点对点

    animation.fromValue = [NSValue valueWithCGPoint:CGPointMake(125, 125)];

    animation.toValue = [NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2)];

    

    animation.autoreverses=YES;

    //持续时间

    animation.duration=time;

  //重复次数

    animation.repeatCount=FLT_MAX;

    animation.removedOnCompletion=NO;

    

    animation.fillMode=kCAFillModeForwards;

    return animation;

}


- (void)animationRevealFromBotton:(float)duration

{

    [UIView animateWithDuration:duration animations:^{

        blackView.transform = CGAffineTransformMakeScale(0.001, 0.001);

        CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];

        animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0.70, 0.40, 0.80)];

        animation.duration = 0.45;

        animation.repeatCount = FLT_MAX;

        [blackView.layer addAnimation:animation forKey:nil];

    } completion:^(BOOL finished) {

        [UIView animateWithDuration:duration animations:^{

            blackView.transform = CGAffineTransformMakeScale(1.0, 1.0);

        }];

    }];

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值