欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS----------弹窗动画

程序员文章站 2023-04-03 13:29:06
- (void)animationAlert:(UIView *)view { CAKeyframeAnimation *popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; popAnimation.dura ......

- (void)animationAlert:(UIView *)view

{

    CAKeyframeAnimation *popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];

    popAnimation.duration = 0.4;

    popAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.01f, 0.01f, 1.0f)],

                            [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.1f, 1.1f, 1.0f)],

                            [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9f, 0.9f, 1.0f)],

                            [NSValue valueWithCATransform3D:CATransform3DIdentity]];

    popAnimation.keyTimes = @[@0.0f, @0.5f, @0.75f, @1.0f];

    popAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],

                                     [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],

                                     [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

    [view.layer addAnimation:popAnimation forKey:nil];

    

}