core-animation

Animated rotation of NSView contents

徘徊边缘 提交于 2019-12-30 11:07:33
问题 I'm trying to rotate the contents of an NSView ( NSButton ) in-place (I.e. from the center. I want to convert - into | ). This can be done with setFrameCenterRotation: … However, I'm trying to animate this, and [[myview animator] setFrameCenterRotation: 90]; causes the control to first jump to the right, and then rotate around the bottom-left corner (0,0) back to the original location. Some people have suggested first setting the anchorPoint : [[myview layer] setAnchorPoint: NSMakePoint(0.5,

Why is -animateWithDuration:delay:options:animations:completion: blocking the UI?

别等时光非礼了梦想. 提交于 2019-12-30 08:42:23
问题 I always thought that Core Animation performs animations on the background. When I run this code, my UI interactions are blocked until the animation finishes: [UIView animateWithDuration:4.5 delay:0 options:options animations:^{ oldView.alpha = 0; newView.alpha = 1; } completion:^(BOOL finished) { if (finished) { [oldView removeFromSuperview]; } }]; Like you can see the duration is long so it's clearly visible that the UI interactions are blocked while animating. The UI interaction begins to

Why is -animateWithDuration:delay:options:animations:completion: blocking the UI?

ぐ巨炮叔叔 提交于 2019-12-30 08:42:08
问题 I always thought that Core Animation performs animations on the background. When I run this code, my UI interactions are blocked until the animation finishes: [UIView animateWithDuration:4.5 delay:0 options:options animations:^{ oldView.alpha = 0; newView.alpha = 1; } completion:^(BOOL finished) { if (finished) { [oldView removeFromSuperview]; } }]; Like you can see the duration is long so it's clearly visible that the UI interactions are blocked while animating. The UI interaction begins to

iOS view transform animation

我是研究僧i 提交于 2019-12-30 04:32:23
问题 I'm probably missing something simple, but trying to do a simple "Ken Burns Effect" with an image view. First the code: [UIView animateWithDuration:20 delay:2 options:UIViewAnimationCurveLinear animations:^{ CGAffineTransform move = CGAffineTransformMakeTranslation(40, 40); CGAffineTransform zoom = CGAffineTransformMakeScale(1.2, 1.2); CGAffineTransform transform = CGAffineTransformConcat(zoom, move); self.imageView.transform = transform; } completion:^(BOOL finished){ NSLog(@"Done"); }]; I

How do I fade in /out a rectangle or text?

霸气de小男生 提交于 2019-12-30 03:26:10
问题 I want to achieve the effect of fade in / fade out the rect or text. I call CGContextFillRect or CGContextShowText in my UIVIew's drawRect: method. I wonder if there is a way to achieve the animation without using UIView' support(i.e. [UIView beginAnimations::]. The desired effect I want to achieve is similar to what in Microsoft's bing serach engine, like those small black squares fade in/ fade out as you move around the web page. Thanks in advance! 回答1: Why do you not want to use UIView's

UIView animation along a round path?

ε祈祈猫儿з 提交于 2019-12-29 04:59:11
问题 I need to make my little guy (in a UIIamgeView) jump forward and it has to look natural. I want to know is there a way to do it with CoreAnimation (beginAnimation/commitAnimation)? I could do it by setting a point in between in the air but the movement looks not natural :P 回答1: Reading Brad Larson's post, I ended up with a nice function to make my image follow a circle. You need to import QuartzCore framework: #import Here is the code: // Set up path movement CAKeyframeAnimation

How to apply partial fade in-out in IOS?

烈酒焚心 提交于 2019-12-29 04:04:11
问题 I have 2 images. One is in the back of the other. I want to fade-out the top image starting from the left corner. How can I do this? Should I use gradient mask? 回答1: Here's a technique that will fade out whatever's in a CALayer, from top-left to bottom-right, revealing whatever is underneath the CALayer. Let's say we're going to fade out the layer of a UIImageView called self.fadeView . We'll create a CAGradientLayer and use it as self.fadeView.layer.mask . The gradient will go from alpha=0

How to apply partial fade in-out in IOS?

做~自己de王妃 提交于 2019-12-29 04:04:09
问题 I have 2 images. One is in the back of the other. I want to fade-out the top image starting from the left corner. How can I do this? Should I use gradient mask? 回答1: Here's a technique that will fade out whatever's in a CALayer, from top-left to bottom-right, revealing whatever is underneath the CALayer. Let's say we're going to fade out the layer of a UIImageView called self.fadeView . We'll create a CAGradientLayer and use it as self.fadeView.layer.mask . The gradient will go from alpha=0

how to rotate CALayer at one point

那年仲夏 提交于 2019-12-28 11:53:33
问题 how to rotate CALayer at one selected point. 回答1: CATransform3D transform = CATransform3DIdentity; transform = CATransform3DTranslate(transform, rotationPoint.x-center.x, rotationPoint.y-center.y, 0.0); transform = CATransform3DRotate(transform, rotationAngle, 0.0, 0.0, -1.0); transform = CATransform3DTranslate(transform, center.x-rotationPoint.x, center.y-rotationPoint.y, 0.0); Where center is the center of your layer, rotationAngle is in radians (positive is counterclockwise), and

how to rotate CALayer at one point

£可爱£侵袭症+ 提交于 2019-12-28 11:53:11
问题 how to rotate CALayer at one selected point. 回答1: CATransform3D transform = CATransform3DIdentity; transform = CATransform3DTranslate(transform, rotationPoint.x-center.x, rotationPoint.y-center.y, 0.0); transform = CATransform3DRotate(transform, rotationAngle, 0.0, 0.0, -1.0); transform = CATransform3DTranslate(transform, center.x-rotationPoint.x, center.y-rotationPoint.y, 0.0); Where center is the center of your layer, rotationAngle is in radians (positive is counterclockwise), and