• CABasicAnimation 基本动画


    几个能够用来实现热门APP应用PATH中menu效果的几个方法

    +(CABasicAnimation *)opacityForever_Animation:(float)time //永久闪烁的动画

    {

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

        animation.fromValue=[NSNumber numberWithFloat:1.0];

        animation.toValue=[NSNumber numberWithFloat:0.0];

        animation.autoreverses=YES;

        animation.duration=time;

        animation.repeatCount=FLT_MAX;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        return animation;

    }

     

    +(CABasicAnimation *)opacityTimes_Animation:(float)repeatTimes durTimes:(float)time; //有闪烁次数的动画

    {

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

        animation.fromValue=[NSNumber numberWithFloat:1.0];

        animation.toValue=[NSNumber numberWithFloat:0.4];

        animation.repeatCount=repeatTimes;

        animation.duration=time;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];

        animation.autoreverses=YES;

        return  animation;

    }

     

    +(CABasicAnimation *)moveX:(float)time X:(NSNumber *)x //横向移动

    {

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

        animation.toValue=x;

        animation.duration=time;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        return animation;

    }

     

    +(CABasicAnimation *)moveY:(float)time Y:(NSNumber *)y //纵向移动

    {

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

        animation.toValue=y;

        animation.duration=time;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        return animation;

    }

     

    +(CABasicAnimation *)scale:(NSNumber *)Multiple orgin:(NSNumber *)orginMultiple durTimes:(float)time Rep:(float)repeatTimes //缩放

    {

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

        animation.fromValue=orginMultiple;

        animation.toValue=Multiple;

        animation.duration=time;

        animation.autoreverses=YES;

        animation.repeatCount=repeatTimes;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        return animation;

    }

     

    +(CAAnimationGroup *)groupAnimation:(NSArray *)animationAry durTimes:(float)time Rep:(float)repeatTimes //组合动画

    {

        CAAnimationGroup *animation=[CAAnimationGroup animation];

        animation.animations=animationAry;

        animation.duration=time;

        animation.repeatCount=repeatTimes;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        return animation;

    }

     

    +(CAKeyframeAnimation *)keyframeAniamtion:(CGMutablePathRef)path durTimes:(float)time Rep:(float)repeatTimes //路径动画

    {

        CAKeyframeAnimation *animation=[CAKeyframeAnimation animationWithKeyPath:@"position"];

        animation.path=path;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];

        animation.autoreverses=NO;

        animation.duration=time;

        animation.repeatCount=repeatTimes;

        return animation;

    }

     

    +(CABasicAnimation *)movepoint:(CGPoint )point //点移动

    {

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

        animation.toValue=[NSValue valueWithCGPoint:point];

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        return animation;

    }

     

    +(CABasicAnimation *)rotation:(float)dur degree:(float)degree direction:(int)direction repeatCount:(int)repeatCount //旋转

    {

        CATransform3D rotationTransform  = CATransform3DMakeRotation(degree, 00,direction);

        CABasicAnimation* animation;

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

     

    animation.toValue= [NSValue valueWithCATransform3D:rotationTransform];

        animation.duration= dur;

    animation.autoreversesNO;

        animation.cumulativeYES;

        animation.removedOnCompletion=NO;

        animation.fillMode=kCAFillModeForwards;

        animation.repeatCount= repeatCount; 

    animation.delegateself;

     

    return animation;

    }


  • 相关阅读:
    主机连接虚拟机redis 服务器
    在dockers中调试dump的dotnet程序
    我的devops实践经验分享一二
    【nodejs】让nodejs像后端mvc框架(asp.net mvc)一样处理请求--请求处理结果适配篇(7/8)
    【nodejs】让nodejs像后端mvc框架(asp.net mvc)一样处理请求--参数自动映射篇(6/8)
    【nodejs】让nodejs像后端mvc框架(asp.net mvc)一样处理请求--请求处理函数装饰器注册篇(5/8)【controller+action】
    【nodejs】让nodejs像后端mvc框架(asp.net mvc)一样处理请求--控制器和处理函数的注册篇(4/8)【controller+action】
    【nodejs】让nodejs像后端mvc框架(asp.net mvc )一样处理请求--控制器的声明定义和发现篇(3/8)
    【nodejs】让nodejs像后端mvc框架(asp.net mvc )一样处理请求--路由限制及选择篇(2/8)【route】
    【nodejs】让nodejs像后端mvc框架(asp.net mvc)一样处理请求--目录(8/8 完结)
  • 原文地址:https://www.cnblogs.com/jzssuanfa/p/6844934.html
Copyright © 2020-2023  润新知