iOS 按键 抖动
来源:互联网 发布:小气泡清洁的危害 知乎 编辑:程序博客网 时间:2024/05/16 08:52
- (void)shake{ CABasicAnimation *moveAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"]; moveAnimation.byValue = [NSNumber numberWithFloat:50.0]; // Here's the important part [moveAnimation setDuration:0.1]; [moveAnimation setBeginTime:0.0]; moveAnimation.fillMode = kCAFillModeForwards; CABasicAnimation *borderWidthAnimation = [CABasicAnimation animationWithKeyPath:@"borderWidth"]; [borderWidthAnimation setFromValue:[NSNumber numberWithFloat:0.0]]; [borderWidthAnimation setToValue:[NSNumber numberWithFloat:20.0]]; // Here's the important part [borderWidthAnimation setDuration:10.0]; [borderWidthAnimation setBeginTime:5.0]; //kCAMediaTimingFunctionLinear kCAMediaTimingFunctionEaseInEaseOut borderWidthAnimation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; CASpringAnimation *springAnimation = [CASpringAnimation animationWithKeyPath:@"position.x"]; [springAnimation setDuration: 1.0]; [springAnimation setBeginTime:0.1]; springAnimation.stiffness = 100; springAnimation.damping = 10; springAnimation.initialVelocity = 15.0; springAnimation.byValue = [NSNumber numberWithFloat:-50.0]; CAAnimationGroup *group = [CAAnimationGroup animation]; [group setDuration:1.0]; [group setAnimations:[NSArray arrayWithObjects:moveAnimation, springAnimation, nil]]; [self.ViewTest.layer addAnimation:group forKey:nil]; self.ViewTest.layer.borderColor = [UIColor yellowColor].CGColor;}
//方法二:
// CABasicAnimation *shakeAnimation = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"]; CABasicAnimation *shakeAnimation = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; shakeAnimation.duration = 0.25f; // shakeAnimation.duration = 0.5f; shakeAnimation.fromValue = [NSNumber numberWithFloat:-5]; shakeAnimation.toValue = [NSNumber numberWithFloat:5]; shakeAnimation.autoreverses = YES; [_imageView.layer addAnimation:shakeAnimation forKey:nil];
0 0
- iOS 按键 抖动
- 按键防抖动程序
- 按键抖动与处理
- 按键防抖动
- 4.3.认识按键抖动并消除抖动
- 按键原理和软硬件按键消抖动
- 按键软件去抖动设计
- 内核定时器消除按键抖动
- ios 抖动动画效果
- ios抖动动画效果
- 仿iOS图标抖动
- ios抖动动画效果
- iOS控件抖动
- ios 左右抖动效果
- iOS 抖动动画
- IOS之抖动效果
- iOS 视图抖动动画
- iOS左右抖动动画
- hdu5616
- jquery的淡入淡出效果
- 关于微信 init接口返回的Count和webwxbatchgetcontact post请求的参数Count
- SIP:100rel 扩展
- Spring 整合Hibernate
- iOS 按键 抖动
- PostgreSQL-函数
- Ogre3D嵌入Qt框架 之 小结
- iOS使用网易云信在线视频聊天
- MonoBehaviour 生命周期
- ios学习 Mac下获取AppStore安装包文件路径
- 非旋转式treap及可持久化
- Apache Stratos探究:4.0.0 Cloud Controller Architecture
- Linux下安装MySql(主备)