Tag: 核心animation

使用animation隐藏和显示滚动视图

在我的应用程序,我有一个滚动视图,当我按下一个button时,它是隐藏的,当我再次按下它出现。 我使用scrollview.hidden = YES (或NO)来做到这一点。 但我想用animation做。 例如,它可能会通过移动而从屏幕底部消失,并以相同的方式显示出来。 我怎样才能做到这一点? 编辑: [UIView beginAnimations:@"myAnimation" context:nil]; CGRect Frame = bottomScroller.frame; if(Frame.origin.y == 380){ Frame.origin.y = 460; }else{ Frame.origin.y = 380; } bottomScroller.frame = Frame; [UIView commitAnimations]; 这解决了我的问题…

如何在需要时停止UIViewanimation?

我有这个代码: -(void)animationLoop{ CGPoint oldPoint = CGPointMake(myCircleUIView.frame.origin.x, myCircleUIView.frame.origin.y); [UIView animateWithDuration:1.0 animations: ^{ myCircleUIView.frame = CGRectMake(myCircleUIView.frame.origin.x + [self randomFloatingGenerator], myCircleUIView.frame.origin.y + [self randomFloatingGenerator], myCircleUIView.frame.size.width, myCircleUIView.frame.size.height); } completion: ^(BOOL finished) { [UIView animateWithDuration:1.0 animations:^{ myCircleUIView.frame = CGRectMake(oldPoint.x, oldPoint.y, myCircleUIView.frame.size.width, myCircleUIView.frame.size.height);} completion: ^(BOOL finished) {[self animationLoop];}]; }]; } 但是我试图停止与它交互的animation,但[myCircleUIView.layer removeAllAnimations]; 会不会做这个工作,有什么build议吗?

将自定义animation添加到popToRootViewController

我正在尝试创build一个自定义animationstream行到根视图控制器。 我想创build一个animation,其中当前用户下滑并揭示下面的新视图控制器,以及我将添加的其他一些东西。 我的大问题是,我不知道如何添加一个自定义animationpopToRootViewController 。 我已经创build了一个自定义animationpresentViewController,但无法弄清楚如何做popToRootViewController同样的事情。 任何帮助都会很棒,顺便说一句,我不一定需要帮助控制器滑下来,我只需要帮助控制器显示任何animation。 下面是我如何创build一个呈现视图控制器的自定义animation: FeedViewController *feed = [[FeedViewController alloc] init]; feed.transitioningDelegate = self; feed.modalPresentationStyle = UIModalPresentationCustom; [self presentViewController:feed animated:YES completion:nil];

animation标签延迟和持续时间Ios

所以我试图animation的标签,将开始与一个文本,然后一定的时间后,它会淡入淡出,新的文本来到屏幕,将在一定的时间后淡出,然后新的文本来。 我希望这个发生recursion。 我需要继续animation15秒,同样的事情发生在接下来的15秒。 – (void)viewDidLoad { [super viewDidLoad]; [self MyLabelAnimation]; } – (void)MyLabelAnimation { self.myLabel.text = @"Text 1"; [UIView animateWithDuration:0.3 animations:^{ self.myLabel.alpha = 1.0; } completion:^(BOOL finished) { [UIView animateWithDuration:0.3 delay:2.7 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.myLabel.alpha = 0.0; } completion:^(BOOL finished) { self.myLabel.text = @"Text 2"; [UIView animateWithDuration:0.3 animations:^{ self.myLabel.alpha = 1.0; } completion:^(BOOL finished) { [UIView […]

SpriteKit如何在每次变化的随机数的animation循环之后重复SKAction?

我有一个SKSpriteNode纹理animation。 我基本上有一个4帧的字符闲置周期和一个眨眼animation序列。 我想要永远循环字符闲置循环,但是让它以随机的间隔播放闪烁的animation序列。 我有以下代码; func playIdle() { let idle_loop = SKAction.repeatAction(action_textureSequence_idle!, count: randomLoopCount()) let sequence = SKAction.sequence([idle_loop, action_textureSequence_blink!]) let repeatSequence = SKAction.repeatActionForever(sequence) runAction(repeatSequence) } func randomLoopCount() -> Int { return Int(arc4random_uniform(10) + 2) } 问题在于,随机数只生成一次,所以眨眼不会随机发生。 就在每次循环次数相同之后。 我如何达到我要找的效果?

如何sorting两个animation之间的延迟

我有一个UIImageView ,我想旋转180度,占用1秒,然后我想在这个位置等待1秒,然后旋转180度回到原来的位置占用1秒。 我如何做到这一点? 我已经尝试了100个方法,它不断回弹而不是回转 编辑:我忘了添加我需要这个重复无限期

在自定义的segue中使用destinationViewControllerbutton

我的目标是定制一个自定义的animation,如下所示:我想让segue用sourceViewController中的一个button来覆盖一个来自destinationViewController的button,其效果类似于导航控制器的推动效果,即新button应该是将旧的button从右向左推。 我已经能够使旧button(从sourceViewController)按需要移开: [UIView animateWithDuration:1.0 animations:^{ // set the target frame for animated view sourceViewController.optionsButton.frame = leftButtonTargetFrame; } completion:^(BOOL finished) { [navigationController pushViewController:destinationViewController animated:NO]; // reset the button's frame back to its original frame sourceViewController.optionsButton.frame = leftButtonInitFrame; }]; 但我努力使新的button(从destinationViewController)进来。原因是, 我无法访问destinationViewController的视图元素 :执行segue时,他们没有实例化。 而且我不能animation一个没有实例化的button。 那么如何用sourceViewController中的buttonreplacesourceViewController中的button?

使用UINavigationController边缘滑动时,CABasicAnimation会重置

我有以下CABasicAnimation在我的viewDidLoad运行一个UINavigationController的视图控制器: CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.duration = 1; animation.additive = NO; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; animation.fromValue = [NSNumber numberWithFloat:0]; animation.toValue = [NSNumber numberWithFloat:-1*(((-windBearing+180) * M_PI) / 180)]; [compass.layer addAnimation:animation forKey:@"90rotation"]; 当我使用边缘轻扫手势慢慢地回溯,animation重置到初始状态,这是相当不和谐的。 我有我的fillMode设置和removedOnCompletion设置为NO ,我错过了什么?

在UIAlertController SWIFT中为每个图像添加一个animation图像

我有一个函数来显示一个UIAlertController。 在标题和文本下面,我想显示每个图像的animation图像。 我有13个图像循环。 func alertDownloadInProgress(text:String, sender:UIViewController) -> UIAlertController { var alert = UIAlertController(title: "Alert", message: text, preferredStyle: UIAlertControllerStyle.Alert) sender.presentViewController(alert, animated: true, completion: nil) return alert } 是否有可能使用UIAlertController或我必须完全自定义我的popup?

UIImageanimation的图像数组

– (IBAction)didTouchAnimate:(UIButton*)sender { UIImage *starImage = [UIImage imageNamed:@"star.png"]; UIImageView *starView = [[UIImageView alloc] initWithImage:starImage]; [starView setCenter:sender.center]; [UIView animateWithDuration:1.50f delay:0.0f options:UIViewAnimationCurveEaseInOutanimations:^{ [starView setCenter:CGPointMake(+100, +100)]; [starView setAlpha:0.6f]; } completion:^(BOOL finished){ [starView removeFromSuperview]; // points++; // NSLog(@"points: %i", points); }]; [self.view addSubview:starView]; } 我有一个数组列表。 我怎样才能让这些图像动起来 Dollars.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"score_animate_0001.png"], [UIImage imageNamed:@"score_animate_0002.png"], [UIImage imageNamed:@"score_animate_0003.png"], [UIImage imageNamed:@"score_animate_0004.png"], [UIImage […]