core-animation

Can you set the anchorPoint of the root layer on an NSView?

风格不统一 提交于 2019-12-21 05:43:04
问题 Is it possible to modify the anchorPoint property on the root CALayer of a layer-backed NSView ? I have a view called myView and it seems every time I set the anchorPoint , it gets overridden in the next run loop. I am doing this: NSView *myView = [[myView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)]; //set the root layer myView.layer = [CALayer layer]; myView.wantsLayer = YES; //gets overridden on the next run loop myView.layer.anchorPoint = CGPointMake(1,1); 回答1: On 10.8, AppKit will

Core Animation 'flip' animation

ぐ巨炮叔叔 提交于 2019-12-21 02:54:16
问题 I'm looking to use Core Animation to simulate a flip clock animation in a Mac application. Currently I have three CALayer's representing the top and bottom half of the digit, and a third used to represent the flip animation (a solution found in the follow article: Creating an iPad flip-clock with Core Animation. The animation of the flip layer is broken into two stages: flipping from the top to the middle of the digit, and then from the middle to the bottom. To achieve this, I use a delegate

Doing completely custom animations with Core Animation - performance

放肆的年华 提交于 2019-12-21 02:52:32
问题 The article https://www.objc.io/issues/12-animations/animating-custom-layer-properties/ has this to say about doing completely custom animations with Core Animation: Suppose that instead of implementing our clock face using individual layers, we wanted to draw the clock using Core Graphics. (In general this will have inferior performance , but it’s possible to imagine that there are complex drawing operations that we might want to implement that would be hard to replicate using ordinary layer

Control a UIView animation's progress manually instead of automatically through the time duration

淺唱寂寞╮ 提交于 2019-12-21 01:38:34
问题 I want to setup a UIView animation, but instead of it taking a given amount of time, i want to control the percentage progress and let it automatically interpolate the values for me. Is that possible? Thanks 回答1: I think i've got it. Immediately after the [UIView animate...] block, do the following on the root view: _view.layer.speed = 0.0; _view.layer.timeOffset = [_view.layer convertTime:CACurrentMediaTime() fromLayer:nil]; And to set the point on the scale, do: _view.layer.timeOffset = 0.

How can I chain Core Animations for different Layers one after the other?

旧街凉风 提交于 2019-12-20 19:44:42
问题 I have a scrollView with paging enabled and a number N of pages, which are UIViews as subviews of the scrollView. I'm trying to do the following: User scrolls to page number n. At that point, 7 CALayers which were previously added to page number n (that is, to page [[scrollView subviews] objectAtIndex:n-1].layer subLayers]) fade in, one after the other. But I can't figure out how to make the CALayers fadeIn sequentially.So far, I've tried the following 3 approaches from my controller's

Animate scrolling of UIScrollView with CoreAnimation

本秂侑毒 提交于 2019-12-20 17:40:54
问题 Sorry for a big question, real question are bold in bottom, now some explanation. I'm use CoreAnimation in my project for animate some objects moving like this. CABasicAnimation *moveAnimation; moveAnimation=[CABasicAnimation animationWithKeyPath:@"position"]; moveAnimation.duration = 2.0; moveAnimation.repeatCount=1; moveAnimation.autoreverses=NO; moveAnimation.delegate = self; moveAnimation.fromValue = [NSValue valueWithCGPoint:[crawler.layer position]]; moveAnimation.fillMode =

How is the presentation layer of a CALayer generated?

巧了我就是萌 提交于 2019-12-20 14:19:16
问题 I'm having difficulties animating my custom layer property using Core Anmiation. My question is how the presentation of a CALayer is generated. Here is what I have now: @interface MyLayer : CALayer { NSMutableDictionary* customProperties; } @property (nonatomic, copy) NSMutableDictionary* customProperties; @end And when I try to animate the key path "customProperties.roll" using CABasicAnimation and addAnimation:forKey:, it seems that the customProperties variable doesn't get copied from the

Core Animation… cyclic animations?

只谈情不闲聊 提交于 2019-12-20 13:54:32
问题 To phrase my question as simply as possible, is there a way to create a core animation sequence to repeat over and over until a stop? Specifically, I'm making a custom class that I want to have a -start and -stop method that will cause it to pulsate. Writing the animation code for the pulse is not the problem, rather, how to make it repetitive? Thanks in advance for any answers! 回答1: According to the documentation, you do it by creating an animation with an extremely large repeatCount (code

Core Animation… cyclic animations?

亡梦爱人 提交于 2019-12-20 13:54:11
问题 To phrase my question as simply as possible, is there a way to create a core animation sequence to repeat over and over until a stop? Specifically, I'm making a custom class that I want to have a -start and -stop method that will cause it to pulsate. Writing the animation code for the pulse is not the problem, rather, how to make it repetitive? Thanks in advance for any answers! 回答1: According to the documentation, you do it by creating an animation with an extremely large repeatCount (code

how to stop core animation?

大憨熊 提交于 2019-12-20 11:09:40
问题 I am animating a button using core animation now on a certain condition I want to stop that animation how do I stop the animation? here is the method to animate the button -(void)animateButton:(UIButton *)btnName { CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; pulseAnimation.duration = .5; pulseAnimation.toValue = [NSNumber numberWithFloat:1.1]; pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName