core-animation

How do I animate/rotate a UIView 90 degress from its upper right corner?

十年热恋 提交于 2019-12-02 19:45:18
I've been searching for hours trying to find a way to animate/rotate a UIView 90 degrees from the upper right corner. The effect should almost work like a swinging door from the top of the screen. Hope someone can help! So right after I pressed enter I suddenly put two and two together and figured the Metronome sample worked kind of like a swinging door and that led me to a few other possibilities. Here's my solution: - (void)viewDidLoad { [super viewDidLoad]; // Set the anchor point and center so the view swings from the upper right swingView.layer.anchorPoint = CGPointMake(1.0, 0.0);

What kind of value is keyTime in an CAKeyFrameAnimation?

南笙酒味 提交于 2019-12-02 19:42:54
For example I have this CAKeyFrameAnimation: CALayer* theLayer = myView.layer; CAKeyframeAnimation* animation; animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.duration = 1.6; //animation.cumulative = YES; animation.repeatCount = 1; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; animation.values = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.0 * M_PI], [NSNumber numberWithFloat:(15.0/180.0) * M_PI], [NSNumber numberWithFloat:(30.0/180.0) * M_PI], // animation stops here... [NSNumber numberWithFloat:(45.0/180.0) *

Animating a gaussian blur using core animation?

巧了我就是萌 提交于 2019-12-02 19:37:39
I'm trying to animate something where it's initially blurry then it comes into focus. I guess it works OK, but when the animation is done it's still a little blurry. Am I doing this wrong? CABasicAnimation* blurAnimation = [CABasicAnimation animation]; CIFilter *blurFilter = [CIFilter filterWithName:@"CIGaussianBlur"]; [blurFilter setDefaults]; [blurFilter setValue:[NSNumber numberWithFloat:0.0] forKey:@"inputRadius"]; [blurFilter setName:@"blur"]; [[self layer] setFilters:[NSArray arrayWithObject:blurFilter]]; blurAnimation.keyPath = @"filters.blur.inputRadius"; blurAnimation.fromValue =

Marrying Core Animation with OpenGL ES

非 Y 不嫁゛ 提交于 2019-12-02 19:36:12
Edit: I suppose instead of the long explanation below I might also ask: Sending -setNeedsDisplay to an instance of CAEAGLLayer does not cause the layer to redraw (i.e., -drawInContext: is not called). Instead, I get this console message: <GLLayer: 0x4d500b0>: calling -display has no effect. Is there a way around this issue? Can I invoke -drawInContext: when -setNeedsDisplay is called? Long explanation below: I have an OpenGL scene that I would like to animate using Core Animation animations. Following the standard approach to animate custom properties in a CALayer, I created a subclass of

Recreate Siri Button Glow Animation

拟墨画扇 提交于 2019-12-02 18:53:52
Is there any way of duplication the siri button glow animation? It looks absolutely gorgeous, but I have no idea at the moment how to start... are there online preformatted pngs that are rotated? or is it done with CoreAnimation? I believe that Siri animation is made with CAEmitterLayer and CAEmitterCell and then animated with core animation, but I might be totally wrong. Here's some code that imitates the effect: // create emitter layer self.emitterLayer = [CAEmitterLayer layer]; self.emitterLayer.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height); self

How to work around poor text rendering in text backed by a CALayer

爷,独闯天下 提交于 2019-12-02 18:53:19
I have some variable text in an NSTextField that renders on a CALayer background view. As a CALayer does not support sub-pixel aliasing for text rendering of any text on top of it, this text looks rubbish. A bit of googling reveals the reasons why this is, and that text must be rendered onto an opaque background to have SPA enabled. Rendering onto an opaque background is something I'd like to avoid if at all possible in this case. Is there a better workaround? I am completely amenable to rendering the text myself into an NSImage , if that will help, but I can't find any confirmed reports that

How do i rotate a CALayer around a diagonal line?

余生颓废 提交于 2019-12-02 18:47:45
I'm trying to implement a flip animation to be used in board game like iPhone-application. The animation is supposed to look like a game piece that rotates and changes to the color of its back (kind of like an Reversi piece ). I've managed to create an animation that flips the piece around its orthogonal axis, but when I try to flip it around a diagonal axis by changing the rotation around the z-axis the actual image also gets rotated (not surprisingly). Instead I would like to rotate the image "as is" around a diagonal axis. I have tried to change layer.sublayerTransform but with no success.

Setting up AVSynchonizedLayer

筅森魡賤 提交于 2019-12-02 17:43:37
I've been trying to produce a proof of concept that connects a video with an animation object (essentially, I am "rotoscoping" a user-selected-bitmap onto a canned video at specific locations). After watching all the available Apple material regarding Core Animation (WWDC10, etc.) and the AVSync..Layer (Apple WWDC10 sample code, doc sample code), there simply isn't a clear enough isolated code example to derive how to implemented this playback mode correctly. Using CA, I have a video asset which is loaded into a CALayer, and an animation which is attached to a bitmap, and then connected to

How to animate while resizing UIView

核能气质少年 提交于 2019-12-02 17:38:51
I saw some material on the web, but still can't quite get to where I want. I need to animate my view downwards, making it's height bigger. Here is my code so far. What's happening here, is that instead of my view resizing, it's just changing it's location a bit up. If I change the proprty instead of "bounds.size" to be "transform.scale.y", it's a little better, only this time it expands the view both up and down, not just downwards. Another thing I'm not of : are these keys just CALayer properties ? where I can find a list of these keys? I would really appreciate help here. Thanks! int x =

Can I animate the UIScrollView contentOffset property via its layer?

自闭症网瘾萝莉.ら 提交于 2019-12-02 17:09:54
I want to zoom and scroll a UIScrollView with a CGPathRef. Because of that I assume I have to animate the UIScrollView's layer property? But which property would I animate that would make it equivalent to doing a UIView animation and setting its contentOffset property and zoomScale ? These are not properties of a CALayer. Any ideas as to how I would approach this? Again, just want to move the scrollview to a certain contentOffset and zoomScale, but not necessarily linearly from point A to point B, zoom A to zoom B, respectively. I was thinking a CAKeyFrameAnimation with a CGPathRef, but I don