抖动效果
来源:互联网 发布:淘宝买东西怎么能便宜 编辑:程序博客网 时间:2024/04/29 20:16
抖动效果
方法1
- (void)earthquake:(UIView*)itemView
{
CGFloat t = 2.0;
CGAffineTransform leftQuake = CGAffineTransformTranslate(CGAffineTransformIdentity, t, -t);
CGAffineTransform rightQuake = CGAffineTransformTranslate(CGAffineTransformIdentity, -t, t);
itemView.transform = leftQuake; // starting point
[UIView beginAnimations:@"earthquake" context:itemView];
[UIView setAnimationRepeatAutoreverses:YES]; // important
[UIView setAnimationRepeatCount:5];
[UIView setAnimationDuration:0.07];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(earthquakeEnded:finished:context:)];
itemView.transform = rightQuake; // end here & auto-reverse
[UIView commitAnimations];
}
- (void)earthquakeEnded:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
if ([finished boolValue])
{
UIView* item = (UIView *)context;
item.transform = CGAffineTransformIdentity;
}
}
方法2
- (void)shakeView:(UIView *)viewToShake
{
CGFloat t = 2.0;
CGAffineTransform translateRight = CGAffineTransformTranslate(CGAffineTransformIdentity, t, 0.0);
CGAffineTransform translateLeft = CGAffineTransformTranslate(CGAffineTransformIdentity, -t, 0.0);
viewToShake.transform = translateLeft;
[UIView animateWithDuration:0.07 delay:0.0 options:UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat animations:^{
[UIView setAnimationRepeatCount:2.0];
viewToShake.transform = translateRight;
} completion:^(BOOL finished) {
if (finished) {
[UIView animateWithDuration:0.05 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
viewToShake.transform = CGAffineTransformIdentity;
} completion:NULL];
}
}];
}
- 抖动效果
- 抖动效果
- 抖动效果
- 抖动效果
- 窗口抖动效果
- Button的抖动效果
- ios 抖动动画效果
- ios抖动动画效果
- android实现抖动效果
- QQ抖动效果
- Cocos2d-x 抖动效果
- 抖动动画效果
- DIV飞入 抖动效果
- 窗口抖动效果
- 窗口抖动效果
- Android控件抖动效果
- cocos2dx屏幕抖动效果
- css3动画 抖动效果
- 帝国cms登陆表单的制作与变量说明
- BIEE回写
- 文件夹复制、递归文件夹、判断文件夹是否存在
- hdu 3047 带权并查集
- Python模块常用的几种安装方式
- 抖动效果
- dojo 的一些心得笔记
- 打印文件【通过创建进程形式方法】
- linux安装apache
- 对TXT文件格式化【通过数据流形式】
- 根据网络地址下载文件
- 正则表达式判断是否为数字
- 12 个很有用的 Chrome 浏览器命令
- WPF给ListBoxItem添加事件