core-animation

CATransition push without fade

[亡魂溺海] 提交于 2019-12-03 00:14:36
I'm making a navigation controller class for Mac OS X. I want to replace the current view with a kCATransitionPush animation. Like in this post: Core Animation Tutorial - Wizard Dialog With Transitions The CATransition is set up like this: CATransition *transition = [CATransition animation]; transition.type = kCATransitionPush; transition.subtype = kCATransitionFromLeft; [self.view setAnimations:@{ @"subviews" : transition }]; However, when I replace the views, there is a fade animation, which is being automatically added. [NSAnimationContext beginGrouping]; { [[self.view animator]

Animate UIButton's title change

妖精的绣舞 提交于 2019-12-03 00:09:19
Here I found how to animate UIButton 's title change using now-deprecated beginAnimations:context: method: UIBUtton title animation for iPhone How to do the same thing using current APIs? Update: I've tried to use block-based animations: NSTimeInterval animationDuration = animated ? 1.f : 0.f; [UIView animateWithDuration:animationDuration delay:0.f options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction animations:^{ [button setTitle:newTitle forState:UIControlStateNormal]; [button setTitleColor:newTitleColor forState:UIControlStateNormal]; } completion

How to get text in a CATextLayer to be clear

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 00:07:01
问题 I've made a CALayer with an added CATextLayer and the text comes out blurry. In the docs, they talk about "sub-pixel antialiasing", but that doesn't mean much to me. Anyone have a code snippet that makes a CATextLayer with a bit of text that is clear? Here's the text from Apple's documentation: Note: CATextLayer disables sub-pixel antialiasing when rendering text. Text can only be drawn using sub-pixel antialiasing when it is composited into an existing opaque background at the same time that

iOS / Core-Animation: Performance tuning

冷暖自知 提交于 2019-12-02 22:48:44
I have my app running on my iPad. but it is performing very badly -- I am getting below 15fps. can anyone help me to optimise? It is basically a wheel (derived from UIView) containing 12 buttons (derived from UIControl). As the user spins it, the buttons dynamically expand and contract (e.g. the one at the 12 o'clock position should always be the biggest) So my wheel contains a: - (void) displayLinkIsCallingBack: (CADisplayLink *) dispLink { : // using CATransaction like this goes from 14fps to 19fps [CATransaction begin]; [CATransaction setDisableActions: YES]; // NEG, as coord system is

How can I enable implicit UIView animation?

吃可爱长大的小学妹 提交于 2019-12-02 22:31:20
问题 Trying to wrap my brain around animations here. Here is my basic situation: _________ |Parent | | | | | | _____ | _____ | |A | | |B | | |_____| | |_____| |_________| where Parent is the parent view and A and B are both UIView instances. I chose to make A and B UIView s because, as I understand it, layers cannot receive user interaction. The animation I want to do is very simple: I simply want A to slide offscreen to the left while B slides in from the right. I tried something like the

Animated pie chart that can animate in both directions

拜拜、爱过 提交于 2019-12-02 22:25:59
问题 I am trying to build an animated pie chart that can animate the pie in both directions depending on whether the value of its progress increases or decreases. I've started with sample code provided here and made some adjustments as suggested here. The trouble is that the back-animation is not yet quite working. It only partially clears the pie. I am not quite sure whether this is due to me using animations incorrectly or calculating coordinates incorrectly, for if I insert

animating the length of circular arrow mask in Core Animation

无人久伴 提交于 2019-12-02 21:25:27
I've created a circular animation using CAShapeLayer and masking. Here is my code: - (void) maskAnimation{ animationCompletionBlock theBlock; imageView.hidden = FALSE;//Show the image view CAShapeLayer *maskLayer = [CAShapeLayer layer]; CGFloat maskHeight = imageView.layer.bounds.size.height; CGFloat maskWidth = imageView.layer.bounds.size.width; CGPoint centerPoint; centerPoint = CGPointMake( maskWidth/2, maskHeight/2); //Make the radius of our arc large enough to reach into the corners of the image view. CGFloat radius = sqrtf(maskWidth * maskWidth + maskHeight * maskHeight)/2; //Don't fill

Layer-backed OpenGLView redraws only if window is resized

≡放荡痞女 提交于 2019-12-02 21:06:50
I have a window with a main view of type NSView and a subview which is a subclass of NSOpenGLView whose name is CustomOpenGLView . The subclass of NSOpenGLView is obtained through a Custom View in Interface Builder and by setting its class to CustomOpenGLView . This is made according to the Apple Sample Code Layer Backed OpenGLView . The app is made to draw something to the OpenGLContext every, let's say, 0.05 seconds. With Core Animation Layer disabled I am able to see the moving object in the view, which is the consequence of the continuous redrawing of the view. And everything works

iPhone Flip Animation using UIViewAnimationTransitionFlipFromLeft in landscape mode

对着背影说爱祢 提交于 2019-12-02 20:53:06
I am working on one iPhone application in which I implemented one animation UIViewAnimationTransitionFlipFromLeft. Here my application works fine in the Portrait mode. It is doing the same animation as specified means Flip from Left to Right. But when I am doing this UIViewAnimationTransitionFlipFromLeft in landscape mode then it is not rotating from left to right. Instead of it is rotating from top to bottom. This is really critical issue. Can you help me out to solve this. The code I am using for iPhone application to rotate the view is as follows: CGContextRef context =

How to make a UIView grow in UIView.animate() with an accurate corner radius?

三世轮回 提交于 2019-12-02 20:31:48
问题 I have this project SwiftySwitch. My goal is to make the circle expand and detract maintaining the form of a circle instead of having a corner radius that is larger than the current circle height in each specific moment of the animation. This code handling the circle growing is here: func turnOn() { let tempView = UIView(frame: CGRect(x: ballDiameter / 2, y: ballDiameter / 2, width: 0, height: 0)) tempView.backgroundColor = onColor tempView.layer.cornerRadius = ballDiameter / 2 self