CABaic Animation animation WithKeyPathのいくつかの規定の値
回転:http://www.cnblogs.com/pengyingh/articles/2379631.html
CABaic Animation animation WithKeyPathのいくつかの規定の値
CABaic Animation animation WithKeyPath Types
When using the‘CABaic Animation’from the QuartzCore Frame ework in Objective-C,you have to specify an animation WithKeyPath. This is a long sting and is not easure listed in the CABaic Animation、CAPropertyAnimation、or the CAAnimation class. I ended up finding a handy chart within the Core Animation Program ming ggguide in Apple’s iPhone OS Reference Library. Hope this helps save someone time,at least it will for me.
人気のあるアプリにPATH中のMEnu効果を適用できるいくつかの方法があります.
+(CABaic Animation) *)opacityForever:(float)time//永久点滅のアニメーション
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「opacity」
アニメイト.froomValue=[NSNumber] number WithFloat:1.0]
アニメイト.toValue=[NSNumber] number WithFloat:0.0]
animation.aut reverses=YES;
animation.duration=time;
animation.repeat Count=FLTuMAX;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)opacityTimes:(float)repeatTimes durTimes:(float)time;/点滅回数のある動画
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「opacity」
アニメイト.froomValue=[NSNumber] number WithFloat:1.0]
アニメイト.toValue=[NSNumber] number WithFloat:0.4]
animation.repeat Count=repeat Times;
animation.duration=time;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
animation.timingFunction=[CAMedia TimingFunction] functionWithName:kcaMediaTimingFunction EaseIn]
animation.aut reverses=YES;
return アニメーション
)
+(CABaic Animation) *)moveX:(float)time X:(NSNumber) *)x//横移動
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.translations.x」
アニメイト.toValue=x;
animation.duration=time;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)moveY:(float)time Y:(NSNumber) *)y/縦移動
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.translations.y」
アニメイト.toValue=y;
animation.duration=time;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)scale:(NSNumber) *)Multile orgin:(NSNumber) *)orginMultile durTimes:(float)time Rep:(float)repeatTimes/スケーリング
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.scale」;
アニメイト.froomValue=orgin Multiple;
アニメイト.toValue=Multiple;
animation.duration=time;
animation.aut reverses=YES;
animation.repeat Count=repeat Times;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CAAnimation Group) *)group Animation:(NSAray) *)アニメイトアーティファクトdurTimes:(float)time Rep:(float)repeatTimes/コンビネーションアニメーション
{
CAAnimation Group *アニメーション=[CAAnimation Group] アニメーション
animation.animations=animationArty;
animation.duration=time;
animation.repeat Count=repeat Times;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CAKeyframe Animation) *)keyframe Aniamtion:(CGMutable PathRef)path durTimes:(float)time Rep:(float)repeatTimes/経路アニメーション
{
CAKeyframe Animation *アニメーション=[CAKeyframe Animation] animation WithKeyPath:@「position」;
animation.path=path;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
animation.timingFunction=[CAMedia TimingFunction] functionWithName:kcaMediaTimingFunction EaseIn]
animation.aut reverses=NO;
animation.duration=time;
animation.repeat Count=repeat Times;
return アニメーション
)
+(CABaic Animation) *)movepoint:(CGPoil) )ポイント/ポイント移動
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.translation」;
アニメイト.toValue=[NSValue] value WithCGPoid:point]
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)rotation:(float)dur degree:(float)degree direction:(int)direction repeat Count:(int)repeat Count/回転
{
CATrans form 3 D rotationTrans form = CATrans form 3 DCMakeRotation(degree) 0, 0,ディレクション);
CABaic Animation*animation;
アニメーション=[CABaic Animation] animation WithKeyPath:@「transform」
アニメイト.toValue=[NSValue] valueWithCATrans form 3 D:rotationTrans form;
animation.duration=dur;
animation.aut reverses= NO;
animation.cumulative= YES;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
animation.repeat Count=repeat Count;
animation.delegate= self;
return アニメーション
)
view拡大と縮小の効果を実現します.
CABaic Animation animation WithKeyPathのいくつかの規定の値
CABaic Animation animation WithKeyPath Types
When using the‘CABaic Animation’from the QuartzCore Frame ework in Objective-C,you have to specify an animation WithKeyPath. This is a long sting and is not easure listed in the CABaic Animation、CAPropertyAnimation、or the CAAnimation class. I ended up finding a handy chart within the Core Animation Program ming ggguide in Apple’s iPhone OS Reference Library. Hope this helps save someone time,at least it will for me.
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
theAnimation.delegate = self;
theAnimation.duration = 1;
theAnimation.repeatCount = 0;
theAnimation.removedOnCompletion = FALSE;
theAnimation.fillMode = kCAFillModeForwards;
theAnimation.autoreverses = NO;
theAnimation.fromValue = [NSNumber numberWithFloat:0];
theAnimation.toValue = [NSNumber numberWithFloat:-60];
[self.view.layer addAnimation:theAnimation forKey:@"animateLayer"];
animationWithKeyPath
animationWithKeyPath :
transform.scale =
transform.scale.x =
transform.scale.y =
transform.rotation.z =
opacity =
margin
zPosition
backgroundColor
cornerRadius
borderWidth
bounds
contents
contentsRect
cornerRadius
frame
hidden
mask
masksToBounds
opacity
position
shadowColor
shadowOffset
shadowOpacity
shadowRadius
[self. ui_View.layer removeAllAnimations];
CABasicAnimation *pulse = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
pulse.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
pulse.duration = 0.5 + (rand() % 10) * 0.05;
pulse.repeatCount = 1;
pulse.autoreverses = YES;
pulse.fromValue = [NSNumber numberWithFloat:.8];
pulse.toValue = [NSNumber numberWithFloat:1.2];
[self.ui_View.layer addAnimation:pulse forKey:nil];
// bounds
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"bounds"];
anim.duration = 1.f;
anim.fromValue = [NSValue valueWithCGRect:CGRectMake(0,0,10,10)];
anim.toValue = [NSValue valueWithCGRect:CGRectMake(10,10,200,200)];
anim.byValue = [NSValue valueWithCGRect:self. ui_View.bounds];
// anim.toValue = (id)[UIColor redColor].CGColor;
// anim.fromValue = (id)[UIColor blackColor].CGColor;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim.repeatCount = 1;
anim.autoreverses = YES;
[ui_View.layer addAnimation:anim forKey:nil];
//cornerRadius
CABasicAnimation *anim2 = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
anim2.duration = 1.f;
anim2.fromValue = [NSNumber numberWithFloat:0.f];
anim2.toValue = [NSNumber numberWithFloat:20.f];
anim2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim2.repeatCount = CGFLOAT_MAX;
anim2.autoreverses = YES;
[ui_View.layer addAnimation:anim2 forKey:@"cornerRadius"];
//contents
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"contents"];
anim.duration = 1.f;
anim.fromValue = (id)[UIImage imageNamed:@"1.jpg"].CGImage;
anim.toValue = (id)[UIImage imageNamed:@"2.png"].CGImage;
// anim.byValue = (id)[UIImage imageNamed:@"3.png"].CGImage;
// anim.toValue = (id)[UIColor redColor].CGColor;
// anim.fromValue = (id)[UIColor blackColor].CGColor;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim.repeatCount = CGFLOAT_MAX;
anim.autoreverses = YES;
[ui_View.layer addAnimation:anim forKey:nil];
[ui_View.layer setShadowOffset:CGSizeMake(2,2)];
[ui_View.layer setShadowOpacity:1];
[ui_View.layer setShadowColor:[UIColor grayColor].CGColor];
//
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
anim.duration = 1.f;
anim.toValue = (id)[UIColor redColor].CGColor;
anim.fromValue = (id)[UIColor blackColor].CGColor;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
anim.repeatCount = CGFLOAT_MAX;
anim.autoreverses = YES;
[ui_View.layer addAnimation:anim forKey:nil];
CABasicAnimation *_anim = [CABasicAnimation animationWithKeyPath:@"shadowOffset"];
_anim.duration = 1.f;
_anim.fromValue = [NSValue valueWithCGSize:CGSizeMake(0,0)];
_anim.toValue = [NSValue valueWithCGSize:CGSizeMake(3,3)];
_anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
_anim.repeatCount = CGFLOAT_MAX;
_anim.autoreverses = YES;
[ui_View.layer addAnimation:_anim forKey:nil];
CABasicAnimation *_anim1 = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
_anim1.duration = 1.f;
_anim1.fromValue = [NSNumber numberWithFloat:0.5];
_anim1.toValue = [NSNumber numberWithFloat:1];
_anim1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
_anim1.repeatCount = CGFLOAT_MAX;
_anim1.autoreverses = YES;
[ui_View.layer addAnimation:_anim1 forKey:nil];
CABasicAnimation *_anim2 = [CABasicAnimation animationWithKeyPath:@"shadowRadius"];
_anim2.duration = 1.f;
_anim2.fromValue = [NSNumber numberWithFloat:10];
_anim2.toValue = [NSNumber numberWithFloat:5];
_anim2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
_anim2.repeatCount = CGFLOAT_MAX;
_anim2.autoreverses = YES;
[ui_View.layer addAnimation:_anim2 forKey:nil];
人気のあるアプリにPATH中のMEnu効果を適用できるいくつかの方法があります.
+(CABaic Animation) *)opacityForever:(float)time//永久点滅のアニメーション
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「opacity」
アニメイト.froomValue=[NSNumber] number WithFloat:1.0]
アニメイト.toValue=[NSNumber] number WithFloat:0.0]
animation.aut reverses=YES;
animation.duration=time;
animation.repeat Count=FLTuMAX;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)opacityTimes:(float)repeatTimes durTimes:(float)time;/点滅回数のある動画
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「opacity」
アニメイト.froomValue=[NSNumber] number WithFloat:1.0]
アニメイト.toValue=[NSNumber] number WithFloat:0.4]
animation.repeat Count=repeat Times;
animation.duration=time;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
animation.timingFunction=[CAMedia TimingFunction] functionWithName:kcaMediaTimingFunction EaseIn]
animation.aut reverses=YES;
return アニメーション
)
+(CABaic Animation) *)moveX:(float)time X:(NSNumber) *)x//横移動
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.translations.x」
アニメイト.toValue=x;
animation.duration=time;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)moveY:(float)time Y:(NSNumber) *)y/縦移動
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.translations.y」
アニメイト.toValue=y;
animation.duration=time;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)scale:(NSNumber) *)Multile orgin:(NSNumber) *)orginMultile durTimes:(float)time Rep:(float)repeatTimes/スケーリング
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.scale」;
アニメイト.froomValue=orgin Multiple;
アニメイト.toValue=Multiple;
animation.duration=time;
animation.aut reverses=YES;
animation.repeat Count=repeat Times;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CAAnimation Group) *)group Animation:(NSAray) *)アニメイトアーティファクトdurTimes:(float)time Rep:(float)repeatTimes/コンビネーションアニメーション
{
CAAnimation Group *アニメーション=[CAAnimation Group] アニメーション
animation.animations=animationArty;
animation.duration=time;
animation.repeat Count=repeat Times;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CAKeyframe Animation) *)keyframe Aniamtion:(CGMutable PathRef)path durTimes:(float)time Rep:(float)repeatTimes/経路アニメーション
{
CAKeyframe Animation *アニメーション=[CAKeyframe Animation] animation WithKeyPath:@「position」;
animation.path=path;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
animation.timingFunction=[CAMedia TimingFunction] functionWithName:kcaMediaTimingFunction EaseIn]
animation.aut reverses=NO;
animation.duration=time;
animation.repeat Count=repeat Times;
return アニメーション
)
+(CABaic Animation) *)movepoint:(CGPoil) )ポイント/ポイント移動
{
CABaic Animation *アニメーション=[CABaic Animation] animation WithKeyPath:@「transform.translation」;
アニメイト.toValue=[NSValue] value WithCGPoid:point]
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
return アニメーション
)
+(CABaic Animation) *)rotation:(float)dur degree:(float)degree direction:(int)direction repeat Count:(int)repeat Count/回転
{
CATrans form 3 D rotationTrans form = CATrans form 3 DCMakeRotation(degree) 0, 0,ディレクション);
CABaic Animation*animation;
アニメーション=[CABaic Animation] animation WithKeyPath:@「transform」
アニメイト.toValue=[NSValue] valueWithCATrans form 3 D:rotationTrans form;
animation.duration=dur;
animation.aut reverses= NO;
animation.cumulative= YES;
animation.removed OnCompration=NO;
animation.fillMode=kcafillModeForwards;
animation.repeat Count=repeat Count;
animation.delegate= self;
return アニメーション
)
view拡大と縮小の効果を実現します.
- (void)viewDidLoad {
[super viewDidLoad];
layer=[CALayer layer];
layer.frame=CGRectMake(50, 200, 50, 50);
layer.backgroundColor=[UIColor orangeColor].CGColor;
layer.cornerRadius=8.0f;
CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
animation.duration=4.0f;
animation.autoreverses=NO;
animation.repeatCount=1;
animation.toValue=[NSNumber numberWithInt:-10];
animation.fromValue=[NSNumber numberWithInt:200];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
CABasicAnimation *animationZoomIn=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
animationZoomIn.duration=2.0f;
animationZoomIn.autoreverses=NO;
animationZoomIn.repeatCount=1;
animationZoomIn.toValue=[NSNumber numberWithFloat:1.56];
animationZoomIn.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
CABasicAnimation *animationZoomOut=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
animationZoomOut.beginTime=2.0f;
animationZoomOut.duration=2.0f;
animationZoomOut.autoreverses=NO;
animationZoomOut.repeatCount=1;
animationZoomOut.toValue=[NSNumber numberWithFloat:.01];
animationZoomOut.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
CAAnimationGroup *group=[CAAnimationGroup animation];
group.duration=4.0f;
group.animations=[NSArray arrayWithObjects: animation, animationZoomIn, animationZoomOut,nil];
group.removedOnCompletion=NO;
group.fillMode=kCAFillModeForwards;
[layer addAnimation:group forKey:nil];
[self.view.layer addSublayer:layer];
//layer.hidden=YES;
}