【代码笔记】iOS-字体抖动动画
来源:互联网 发布:金融界名人名言 知乎 编辑:程序博客网 时间:2024/05/18 00:29
一,效果图。
二,代码。
ViewController.m
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame=CGRectMake(10, 100, 100, 200); button.backgroundColor=[UIColor redColor]; [button setTitle:@"按钮" forState:UIControlStateNormal]; [self.view addSubview:button]; //按钮的动画效果 [self buttonAnimation:button]; }//按钮出现的时候有一个动画效果- (void)buttonAnimation:(UIButton *)sender{ CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; CATransform3D scale1 = CATransform3DMakeScale(0.5, 0.5, 1); CATransform3D scale2 = CATransform3DMakeScale(1.2, 1.2, 1); CATransform3D scale3 = CATransform3DMakeScale(0.9, 0.9, 1); CATransform3D scale4 = CATransform3DMakeScale(1.0, 1.0, 1); NSArray *frameValues = [NSArray arrayWithObjects: [NSValue valueWithCATransform3D:scale1], [NSValue valueWithCATransform3D:scale2], [NSValue valueWithCATransform3D:scale3], [NSValue valueWithCATransform3D:scale4], nil]; [animation setValues:frameValues]; NSArray *frameTimes = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.5], [NSNumber numberWithFloat:0.9], [NSNumber numberWithFloat:1.0], nil]; [animation setKeyTimes:frameTimes]; animation.fillMode = kCAFillModeForwards; animation.duration = 0.3f; [sender.layer addAnimation:animation forKey:@"DSPopUpAnimation"];}
0 0
- 【代码笔记】iOS-字体抖动动画
- ios 抖动动画效果
- ios抖动动画效果
- ios抖动动画效果
- iOS 抖动动画
- iOS 视图抖动动画
- iOS左右抖动动画
- ios 动画(抖动,入场动画,组动画)
- 安卓仿IOS删除抖动动画
- 【IOS动画】视图左右抖动动画效果
- 【代码笔记】iOS-等待动画
- 【代码笔记】iOS-浇花动画
- 【代码笔记】iOS-拍照动画
- 【代码笔记】iOS-Transition动画
- 【代码笔记】iOS-UIActionSheet字体的修改
- iOS 模仿系统的抖动动画
- ios view抖动动画(相当实用)
- iOS简单的抖动动画效果
- 剑指offer(动态规划-LeetCode72)
- 如何写出高效C++(构造/析构/赋值运算)
- BOM操作
- 03.运算符
- Touchable系列组件
- 【代码笔记】iOS-字体抖动动画
- sersync2实时同步
- 在win7(32位)系统上装ubuntu(64位)虚拟机,提示二进制长模式不兼容
- CSharp进行JSON的序列化和反序列化
- POJ 2508
- Google推荐的图片加载库Glide使用
- - Wooden Sticks
- Android禁止ViewPager的左右滑动
- 每天读点《道德经》