晃动提醒
来源:互联网 发布:哪些软件看电影免费 编辑:程序博客网 时间:2024/04/28 02:16
#import <QuartzCore/QuartzCore.h>
@interface CAKeyframeAnimation (shakeAnimation)
+ (CAKeyframeAnimation *)shakeAnimation:(CGRect)frame;
@end
#import "CAKeyframeAnimation+shakeAnimation.h"
@implementation CAKeyframeAnimation (shakeAnimation)
static int numberOfShakes =8;//震动次数
static float durationOfShake =0.5f;//震动时间
static float vigourOfShake =0.02f;//震动幅度
+ (CAKeyframeAnimation *)shakeAnimation:(CGRect)frame
{
CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimationanimationWithKeyPath:@"position"];
CGMutablePathRef shakePath =CGPathCreateMutable();
CGPathMoveToPoint(shakePath,NULL,CGRectGetMidX(frame),CGRectGetMidY(frame) );
for (int index =0; index <numberOfShakes; ++index)
{
CGPathAddLineToPoint(shakePath,NULL,CGRectGetMidX(frame) - frame.size.width *vigourOfShake,CGRectGetMidY(frame));
CGPathAddLineToPoint(shakePath,NULL, CGRectGetMidX(frame) + frame.size.width *vigourOfShake,CGRectGetMidY(frame));
}
CGPathCloseSubpath(shakePath);
shakeAnimation.path = shakePath;
shakeAnimation.duration = durationOfShake;
CFRelease(shakePath);
return shakeAnimation;
}
@end
- 晃动提醒
- 屏幕晃动
- 提醒
- 提醒
- 提醒
- 提醒
- 提醒
- 提醒
- iPhone 判断手机晃动
- iphone 晃动检测方法
- 检测iphone晃动
- ios晃动的检测
- iOS 晃动手势
- CAKeyframeAnimation实现晃动
- iOS 晃动手势
- iOS - 晃动检测
- textfield的晃动
- 实现文本框的晃动
- 翻译(汉译英) 仅供参考
- 计算器负号的处理
- dll导出类
- 一步一步学Linq to sql(五):存储过程
- 图形学实战代码总结
- 晃动提醒
- Pollarize.me成伦敦创业周末最后赢家
- T-SQL、Jet SQL、PL-SQL 的含义
- poj 2505 A multiplication game(博弈)
- LNMP架构php升级问题及解决方法 php-5.3.10升级到php-5.4.0
- 并查集
- 基于phonegap开发的移动应用插入广告的方法
- USB Video Class Specification 笔记
- C语言之#define用法总结