Tag: 核心animation

如何知道视图是否可见?

说我有两个视图控制器:xVC和yVC。 我已经使用了-(void)motionBegan API,并使用了方法-(void)motionBegan , -(void)motionEnded:和-(void)motionCancelled在xVC中取消。 发生什么事是当设备被震动,它发射一个简单的animation。 现在的事情是,即使当我有yVC打开,即当yVS.view已被添加为子视图,这个animation被解雇。 我正在寻找的是一些如果我可以使用的条件-(void)motionEnded:像这样: if(yVC == nil) { //trigger animation } 我的意思是,当yVC可见时,震动不应该起作用。 我怎么做? 请帮忙。

移动设备无法使用CSSanimation

我涉足CSSanimation,我不能为我的生活弄清楚为什么这不是我的iPhone 5(Chrome和Safari)。 编辑:具体来说,我得到了最终状态,根本没有任何议案 animation| Codepen.io 部分animation代码: @keyframes base { 0% {transform: scale(0);} 10% {transform: scale(1.1);} 30% {transform: scale(.98);} 50% {transform: scale(1);} 60% {transform: scale(1);} 70% {transform: scale(1.3);} 90% {transform: scale(0);} 100% {transform: scale(0);} }

如何区分animation从ios单精灵表单?

我正在使用sprite工作表的应用程序没有cocos2D帮助。 我使用下面的图像作为精灵表 在弓图中有许多不同的图像。 我想让他们在不同的位置animation 我按照这个教程,但它只有一个animation UIKit的-TexturePacker 我想在没有cocos2d(使用UIKIT)的帮助下实现这一点。 任何帮助,将不胜感激。

如何在横向模式下从底部滑动UIView

我已经添加了一个UIView到IB的另一个“主”视图。 我的应用程序仅处于横向模式。 我想这样做,通过按下button,这个其他UIView从底部滑入。 所以,目前它不在图片中,但是当按下button时,视图从底部出现并滑入到位。 稍后,我将使用与切换button相同的button,然后将UIVIew滑出。 UIView不是屏幕的大小,否则我会以模态方式呈现它。 这是我试过的代码: .M -(IBAction)onGearBag:(UIButton *)sender { [sender setEnabled:NO]; [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ if (gearBag.transform.ty == 0) { [gearBag setTransform:CGAffineTransformMakeTranslation(0, -400)]; }else{ [gearBag setTransform:CGAffineTransformMakeTranslation(0, -200)]; } }completion:^(BOOL done){ //some completion handler [sender setEnabled:YES]; }]; } 。H @interface MyEquipmentViewController : PFViewController { IBOutlet UIView *gearBag; } @property (strong, nonatomic) TabsTopBar *topbar; […]

如何通过重复和自动反向来减慢animation

我正在使用UIView animateWithDuration。 我用UIView beginAnimation,但是苹果说从iOS4.0开始使用新的方法会更好。 我有一个问题,但。 我不能减慢我想要的animation。 [UIView animateWithDuration:25.0f delay:0.0f options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse) animations:^ {self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width*0.97f, self.frame.size.height*0.97f);} completion:nil]; 我可以将animateWithDuration的值更改为我想要的值,并始终执行相同的animation! 谢谢您的帮助

swift animateWithDuration在iOS 7中不起作用

我有一个在iOS 8.1中运行正常的animation,但在iOS 7.1中,button只出现在没有animation的地方。 该button的前导,尾部和底部约束为0,高度约束为80.约束条件在故事板中设置。 在viewWillAppear方法中,我将底部约束更改为-80,以便在开始时不会看到。 当用户按下一个button,button应该动起来,我运行这个方法: func animateCtaUp() { self.ctaView.layoutIfNeeded() UIView.animateWithDuration(0.5, delay: 0, options: .CurveEaseOut, animations: { self.ctaViewBottomConstraint.constant = 0 self.ctaView.layoutIfNeeded() }, completion: { finished in }) }

在自定义视图中制作2个animation

我创build一个自定义的视图,它包含像本教程之后的 刷新 ,* LayoutSubviews *的方法 我想要一个标签animation越来越大,它的全宽,然后回到0宽度。 我在“刷新”方法使用此代码: [UIView animateWithDuration:1.3 animations:^{ CGRect frame = CGRectMake(50, 15, 140, 20); [labelFav setFrame:frame]; } completion:^(BOOL finished) { //[labelFav setHidden:YES]; [UIView animateWithDuration:1.3 animations:^{ CGRect frame = CGRectMake(50, 15, 0, 20); [labelFav setFrame:frame]; }]; }]; 该代码可以在任何其他视图上工作,但是由于某种原因,这是一个自定义视图,所以完成块没有执行。 发生什么事是它只做第一块。 我在“完成”块中设置了一个断点,它停在那里,但animation不会发生。 我试图设置隐藏的标签,但仍然没有发生。 有任何想法吗?

无法同时计算两个CABasicAnimations

我正在尝试animation一个图层的strokeEnd属性,以及另一个图层的position 。 我试图设置两个持续时间相同的CABasicAnimations,但一个比另一个更早完成。 我不能为了我的生活理解为什么。 CALayer *trackingDotPresentationLayer = (CALayer *)trackingDot.presentationLayer; CABasicAnimation *trackingDotMovementAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; trackingDotMovementAnimation.duration = lineDrawDuration; trackingDotMovementAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; trackingDotMovementAnimation.fromValue = [NSValue valueWithCGPoint:trackingDotPresentationLayer.position]; trackingDot.position = futureTrackingDotFrame.origin; trackingDotMovementAnimation.toValue = [NSValue valueWithCGPoint:futureTrackingDotFrame.origin]; trackingDotMovementAnimation.fillMode = kCAFillModeForwards; [trackingDot addAnimation:trackingDotMovementAnimation forKey:@"trackingDotMovement"]; CABasicAnimation *lineAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; lineAnimation.duration = lineDrawDuration; lineAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; lineAnimation.fromValue = @0.0; lineLayer.strokeEnd = […]

核心animation警告:“未提交的CATransaction”

我只收到以下警告: CoreAnimation: warning, deleted thread with uncommitted CATransaction; created by: 0 QuartzCore 0x3763c65d <redacted> + 220 1 QuartzCore 0x3763c541 <redacted> + 224 2 QuartzCore 0x3763fe2f <redacted> + 30 3 QuartzCore 0x3763b9bf <redacted> + 318 4 QuartzCore 0x3763b87b <redacted> + 50 5 QuartzCore 0x3763b80b <redacted> + 538 6 MyApp 0x000df597 -[CommonClass orangeGradient:] + 382 7 MyApp […]

如何完全使用animationWithDuration和transitionWithView

我尝试使用animationWithDuration和transitionWithView来创build一个大的animation。 我想要做这样的事情: 使用animationWithDuration移动视图A. 在step1完成之后,使用animationWithDuration移动视图B. 在step2完成之后,用transitionWithView(With OptionCurlDown)显示视图C, 我真的看过网,我不知道该怎么做。 我的问题是,步骤3始终与步骤A同时开始。如果我只做步骤1和步骤2,这是好的,我的意思是,步骤2只有当步骤1完成时才会启动。 但是我没有第三步的运气! 我也尝试在animationWithDuration中嵌套transitionWithView,但结果是一样的, 谢谢 更新 以下是代码本身: 主function: [fileMenuController hide:0.2 andDelay:0.1]; [drawingToolController show:0.2 andDelay:0.2]; [penSizeMenuController showSubViewWithDuration:0.4]; fileMenuController隐藏function: [UIView animateWithDuration:duration //begin animation delay:delay options:UIViewAnimationCurveEaseIn animations:^{ [self.view setFrame:CGRectOffset([self.view frame], 0, -self.view.frame.size.height)]; } completion:nil ]; drawingToolController显示function: [UIView animateWithDuration:duration //begin animation delay:delay options:UIViewAnimationCurveEaseIn animations:^{ [self.view setFrame:CGRectOffset([self.view frame], 0, self.view.frame.size.height)]; } completion:nil ]; penSizeController显示function: […]