When using the ‘CABasicAnimation’ from the QuartzCore Framework in Objective-C, you have to specify an animationWithKeyPath. This is a long string and is not easily listed in the CABasicAnimation, CAPropertyAnimation, or the CAAnimation class. I ended up finding a handy chart within the Core Animation Programming guide in Apple’s iPhone OS Reference Library. Hope this helps save someone time, at least it will for me.
//The following code moves a view up 60 pixels and stops. 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"];
相关推荐
SKBounce动画 SKBounceAnimation是一个CAKeyframeAnimation子类,它根据...SKBounceAnimation *bounceAnimation = [SKBounceAnimation animationWithKeyPath:keyPath]; bounceAnimation.fromValue = [NSNumber numbe
ForAnimationCALayer的各种动画效果IntroduceIOS--CALayer实现,界限、透明度、位置、旋转、缩放组合动画基于框架:QuartzCore.framework//抖动CABasicAnimation* shake = [CABasicAnimation animationWithKeyPath:@...
CABasicAnimation *bas=[CABasicAnimation animationWithKeyPath:@"strokeEnd"]; bas.duration=1; bas.delegate=self; bas.fromValue=[NSNumber numberWithInteger:0]; bas.toValue=[NSNumber ...
(翻转)方式一: [NSTimer scheduledTimerWithTimeInterval:3.f repeats:YES block:^(NSTimer ... rotationAnimation = [CABasicAnimation animationWithKeyPath:@transform.rotation.y]; rotationAnimation.toValue
animationWithKeyPath: @" position.y " ]; moveToBottom.duration = 1.5 ; moveToBottom.byValue = @( 100 . 0f ); // move animation(to right) CABasicAnimation *moveToRight = [ CABasicAn
前言 一个简单的利用 透明度... CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@opacity]; opacityAnimation.duration = 0.4 * duration; opacityAnimation.fromValue = @0.f; op
EasingAnimation This class is used for Easing animation. Easy to understand ... [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; // 设置值 [animation setValues:[YXEasing calculate