caanimation

UIPercentDrivenInteractiveTransition With CABasicAnimation

五迷三道 提交于 2019-11-28 23:37:37
When using gesture driven UIPercentDrivenInteractiveTransition with CABasicAnimation (or any other CAAnimation), upon finishInteractiveTransition, animation jumps to final position, rather then animating smoothly as is the case when using UIView block animation. I am trying to figure out how to animate smoothly upon finishInteractiveTransition to end when using CAAnimation. I have now spent whole day on it. There seems to be no mention anywhere about using CAAnimation with custom VC transitions, everyone refers to UIView block based animation. I have create a small sample project that

CATransaction completion being called immediately

一笑奈何 提交于 2019-11-28 17:46:48
I'm trying to execute a completion-block after my CAAnimation has finished. However, it seems that animation block is called before my animation completes. The animation still happens correctly though. [CATransaction begin]; [self.view.layer addAnimation:self.dropAndBounceAnimation forKey:@"appearance"]; [CATransaction setCompletionBlock:completionBlock]; [CATransaction commit]; The dropAndBounceAnimation is a CAKeyFrameAnimation on position.y, with a fixed duration. I'm not sure if this really is the correct fix, but by setting the completion-block before adding the animation for the layer,

Cannot get current position of CALayer during animation

末鹿安然 提交于 2019-11-28 17:06:49
I am trying to achieve an animation that when you hold down a button it animates a block down, and when you release, it animates it back up to the original position, but I cannot obtain the current position of the animating block no matter what. Here is my code: -(IBAction)moveDown:(id)sender{ CGRect position = [[container.layer presentationLayer] frame]; [movePath moveToPoint:CGPointMake(container.frame.origin.x, position.y)]; [movePath addLineToPoint:CGPointMake(container.frame.origin.x, 310)]; CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"]; moveAnim

How can I create an CABasicAnimation for multiple properties?

早过忘川 提交于 2019-11-28 16:32:17
I have this code to animate a CALayer element. CABasicAnimation *makeBiggerAnim=[CABasicAnimation animationWithKeyPath:@"radius"]; makeBiggerAnim.duration=0.2; makeBiggerAnim.fromValue=[NSNumber numberWithDouble:20.0]; makeBiggerAnim.toValue=[NSNumber numberWithDouble:40.0]; makeBiggerAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; My question is, now everything works fine, I would like another attribute of the same element at the same time. I've seen you can do additive animations and stuff. My question is: Is the additive attribute the best

Update view's frame while it's being animated

微笑、不失礼 提交于 2019-11-28 09:08:41
问题 I'm doing an animation like this: CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; animation.duration = 100.0; animation.path = self.animationPath.CGPath; [view.layer addAnimation:animation forKey:@"animation"]; Works fine, however, this now fails when trying to detect touches on the object that is moving around the screen: - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { for (UIView* subview in self.subviews ) { if ( [subview hitTest:

UIButton not interacting during animation

蓝咒 提交于 2019-11-28 07:16:36
问题 I'm trying to animate a UIButton. But during it's animation, there is no interaction with the UIButton. Expected behavior is to be able to click on the button while it's moving. Here's the code snippet of the UIButton and animation: UIImage *cloudImage = [UIImage imageNamed:@"sprite.png"]; UIButton moveBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [moveBtn setFrame:CGRectMake(0.0, 80.0, cloudImage.size.width, cloudImage.size.height)]; [moveBtn setImage:cloudImage forState

How to chain different CAAnimation in an iOS application

最后都变了- 提交于 2019-11-27 18:49:55
I need to chain animations, CABasicAnimation or CAAnimationGroup but I don't know how to do it, the only that I do is that all the animation execute at the same time for the same layer. How could I do it? For example, a layer with its contents set to a car image: 1st: move X points to right 2nd: Rotate 90ª to left 3rd: Move X point 4th: Scale the layer All this animations must be executed in a secuencial way, but I can't do it :S BTW: I am not english, sorry if I made some mistakes in my grammar :D tl;dr: You need to manually add each animation after the previous finishes. There is no built in

UIPercentDrivenInteractiveTransition With CABasicAnimation

痞子三分冷 提交于 2019-11-27 15:05:05
问题 When using gesture driven UIPercentDrivenInteractiveTransition with CABasicAnimation (or any other CAAnimation), upon finishInteractiveTransition, animation jumps to final position, rather then animating smoothly as is the case when using UIView block animation. I am trying to figure out how to animate smoothly upon finishInteractiveTransition to end when using CAAnimation. I have now spent whole day on it. There seems to be no mention anywhere about using CAAnimation with custom VC

CATransaction completion being called immediately

自作多情 提交于 2019-11-27 10:59:59
问题 I'm trying to execute a completion-block after my CAAnimation has finished. However, it seems that animation block is called before my animation completes. The animation still happens correctly though. [CATransaction begin]; [self.view.layer addAnimation:self.dropAndBounceAnimation forKey:@"appearance"]; [CATransaction setCompletionBlock:completionBlock]; [CATransaction commit]; The dropAndBounceAnimation is a CAKeyFrameAnimation on position.y, with a fixed duration. 回答1: I'm not sure if this

Animate text change in UILabel

偶尔善良 提交于 2019-11-27 05:55:11
I'm setting a new text value to a UILabel . Currently, the new text appears just fine. However, I'd like to add some animation when the new text appears. I'm wondering what I can do to animate the appearance of the new text. SwiftArchitect Objective-C To achieve a true cross-dissolve transition (old label fading out while new label fading in), you don't want fade to invisible. It would result in unwanted flicker even if text is unchanged . Use this approach instead: CATransition *animation = [CATransition animation]; animation.timingFunction = [CAMediaTimingFunction functionWithName