`
ydbc
  • 浏览: 720386 次
  • 性别: Icon_minigender_1
  • 来自: 大连
文章分类
社区版块
存档分类
最新评论

activate 动画 animation

 
阅读更多

View之间切换的动态效果设置:

<wbr><wbr><wbr>SettingsController *settings = [[SettingsController alloc]initWithNibName:@"SettingsView" bundle:nil];<br><wbr><wbr><wbr>settings.modalTransitionStyle = UIModalTransitionStyleFl<wbr>ipHorizontal;<wbr>//水平翻转<br><wbr><wbr><wbr>[self presentModalViewControll<wbr>er:settings animated:YES];<br><wbr><wbr><wbr>[settings release];</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>



- (IBAction) activate:(UIView*)view

{

CGContextRef context = UIGraphicsGetCurrentContext();

[UIView beginAnimations:nilcontext:context];

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

[UIView setAnimationDuration:CONST_animation_time];

[view setCenter:UpPointOfView(view)];

CABasicAnimation *scalingAnimation = (CABasicAnimation *)[view.layeranimationForKey:@"scaling"];

if (!scalingAnimation)

{

scalingAnimation = [CABasicAnimationanimationWithKeyPath:@"transform"];

scalingAnimation.repeatCount=1;

scalingAnimation.duration=CONST_animation_time;

scalingAnimation.autoreverses=NO;

scalingAnimation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseOut];

scalingAnimation.fromValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.0,1.0, 1.0)];

scalingAnimation.toValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(CONST_enlarge_proportion,CONST_enlarge_proportion, 1.0)];

}

[view.layer addAnimation:scalingAnimationforKey:@"scaling"];

view.layer.transform =CATransform3DMakeScale(CONST_enlarge_proportion,CONST_enlarge_proportion, 1.0);

[UIView commitAnimations];

}


- (IBAction) deactivate:(UIView*)view

{

CGContextRef context = UIGraphicsGetCurrentContext();

[UIView beginAnimations:nilcontext:context];

[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

[UIView setAnimationDuration:CONST_animation_time];

[view setCenter:DownPointOfView(view)];

CABasicAnimation *scalingAnimation = (CABasicAnimation *)[view.layeranimationForKey:@"descaling"];

if (!scalingAnimation)

{

scalingAnimation = [CABasicAnimationanimationWithKeyPath:@"transform"];

scalingAnimation.repeatCount=1;

scalingAnimation.duration=CONST_animation_time;

scalingAnimation.autoreverses=NO;

scalingAnimation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseOut];

scalingAnimation.fromValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(CONST_enlarge_proportion,CONST_enlarge_proportion, 1.0)];

scalingAnimation.toValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.0,1.0, 1.0)];

}

[view.layer addAnimation:scalingAnimationforKey:@"descaling"];

view.layer.transform =CATransform3DMakeScale(1.0,1.0, 1.0);

[UIView commitAnimations];

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics