core-animation

What is the role of key path in Core Animation?

▼魔方 西西 提交于 2019-12-07 07:09:58
问题 I'm getting acquanted with Core Animation and trying to implement simple movement along a curve line. i've found really helpful piece of code here There is a line there: CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; Why do we need this property named keyPath? What is its role? The code works only if use the proposed NSString @"position" and nothing else. So is it a built-in constant string? It doesn't look so. Hope you see my confusion. Can you

Customise UINavigationController animation: CATransition

南楼画角 提交于 2019-12-07 07:03:04
问题 I have an UINavigationController. I made VC1 the rootViewController and programatically load VC2 from VC1 and then have the custom animation to go from VC1 to VC2. Standard. Everything is fine and good. Now, I would like to have a custom animation between the two like so: In sum, VC1 slides out of view while VC2 is beneath it. Just like a stack of paper where you slide away the first sheet (VC1) and thus reveal the sheet beneath (VC2). So what I tried is the following code which is called

iOS Core Animation: incorrect anchor point for rotation

ⅰ亾dé卋堺 提交于 2019-12-07 06:42:47
问题 I would like to implement a basic rotation animation in iOS, where the view is continuously rotating around its center point. However, for some reason, the rotation's anchor point is always the parent view's origin, and not the rotating view's center. Therefore, the view is rotating around the upper left corner of the screen, even if I manually set the anchor point. Here's what I'm doing: // Add shape layer to view CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; CGRect shapeRect =

How come my Core Animation transformation always returns to it's start-state?

倾然丶 夕夏残阳落幕 提交于 2019-12-07 05:52:19
问题 I am trying to perform some kind of animation of a layer in my iPhone application. It does not matter what I do I always get the same results: after the animation is done it jerks back into it's original position. Even though I set removedOnCompletion to false there is no difference. What am I missing here? Thanks in advance! EDIT: Really need help with this one guys. I am creating animations with CAKeyframeAnimation and CABasicAnimation objects, then adding them to a CAAnimationGroup which I

CALayer as SubLayer Not Visible

你。 提交于 2019-12-07 05:25:55
问题 I am trying to built an animated circle which would be drawn clockwise until it becomes complete circle as illustrated in iPhone Core Animation - Drawing a Circle Problem is that CALayer object is not added or build. I tested and saw that it is not accessing my drawInContext:CGContextRef and animatingArc methods. What so far I have done is: In AnimateArc.h @interface AnimateArc : CALayer { CAShapeLayer *circle; } -(void) animatingArc; @end In AnimateArc.m -(void) drawInContext:(CGContextRef

multiple CAKeyframeAnimation in different layers at the same time

只愿长相守 提交于 2019-12-07 04:56:22
问题 Does anyone now how can I animate multiple layers at the same time using CAKeyframeAnimation ? Each layer has its own CAKeyframeAnimation object. Take a look at the code below: I have a method that receives an object, creates the CAKeyframeAnimation and attaches the animation to it: - (void)animateMovingObject:(CALayer*)obj fromPosition:(CGPoint)startPosition toPosition:(CGPoint)endPosition duration:(NSTimeInterval)duration { CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation

Slow down & accelerate animations with CoreAnimation

二次信任 提交于 2019-12-07 04:50:03
问题 I am trying to apply a slow-motion effect to my application, pretty much like how you can slow down most graphical effects of Mac OS if you press Shift. My application uses CoreAnimation, so I thought it should be no biggie: set speed to some slower value (like 0.1 ) and set it back to 1 once I'm done, and here I go. It seems, unfortunately, that this is not the right way. The slowdown works great, however when I want to get back to normal speed, it resumes as if the speed was 1 the whole

Why when I set a low duration value for my CABasicAnimation does it jump?

旧巷老猫 提交于 2019-12-07 04:13:39
问题 Sample Project: http://cl.ly/1W3V3b0D2001 I'm using CABasicAnimation to create a progress indicator that is like a pie chart. Similar to the iOS 7 app download animation: The animation is set up as follows: - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGFloat radius = CGRectGetWidth(self.frame) / 2; CGFloat inset = 1; CAShapeLayer *ring = [CAShapeLayer layer]; ring.path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(self.bounds, inset, inset) cornerRadius:radius-inset].CGPath

What does selecting CALayer in View Effects Inspector inside Interface Builder do?

白昼怎懂夜的黑 提交于 2019-12-07 03:08:06
问题 Inside IB, in View Effects Inspector, there is an option to set Core Animation Layer. If I set it what does it do? Is it equivalent to setWantsLayer:YES ? If so then as per Apple docs setWantsLayer can be called before or after setLayer: . The order that setWantsLayer: and setLayer: are called is important, it makes the distinction between a layer-backed view and a layer-hosting view. If I set CALayer from IB, which order would it be? 回答1: The checkbox makes your view layer-backed (like

Changing frame of UIView's CALayer (self.view.layer.frame = …) appears to have no effect

≡放荡痞女 提交于 2019-12-07 03:03:07
问题 I'm sure I'm missing something basic here. I'm trying out the CALayers 'hello world' code from: http://www.raywenderlich.com/2502/introduction-to-calayers-tutorial Doing the very first example. New single view project in xcode 4.2. No change to the nib/storyboard. Import QuartzCore. Add the following code to ViewDidLoad in the ViewController.m: - (void)viewDidLoad { [super viewDidLoad]; self.view.layer.backgroundColor = [UIColor blueColor].CGColor; self.view.layer.cornerRadius = 30.0; self