core-animation

Animating GMSMarker in a circular path

一笑奈何 提交于 2019-12-24 01:45:30
问题 I understand how to normally animation other CALayers in a circular path based on this SO question: iPhone - How to make a circle path for a CAKeyframeAnimation? However, the GMSMarkerLayer is a special subclass of CALayers that does not seem to respond to the "position" keypath (following instructions in that link does nothing that I can visibly see) but instead will respond to the "latitude" and "longitude" keypaths instead. Here's the code that I've tried: CAKeyframeAnimation

Animating GMSMarker in a circular path

可紊 提交于 2019-12-24 01:45:01
问题 I understand how to normally animation other CALayers in a circular path based on this SO question: iPhone - How to make a circle path for a CAKeyframeAnimation? However, the GMSMarkerLayer is a special subclass of CALayers that does not seem to respond to the "position" keypath (following instructions in that link does nothing that I can visibly see) but instead will respond to the "latitude" and "longitude" keypaths instead. Here's the code that I've tried: CAKeyframeAnimation

Animate a CAShapeLayer's subclass custom property based on the path property

风流意气都作罢 提交于 2019-12-24 01:07:42
问题 I've got a CAShapeLayer subclass which features two properties, a startPoint and an endPoint. These properties aren't directly drawn into the context but rather used to alter the path property, similar to the transform, position and bounds properties. Here's the code of the whole layer -(void)setStartPoint:(CGPoint)startPoint { if (!CGPointEqualToPoint(_startPoint, startPoint)) { _startPoint = startPoint; [self reloadPath]; } } -(void)setEndPoint:(CGPoint)endPoint { if (!CGPointEqualToPoint(

How could I type check CGColor / CGPath?

拥有回忆 提交于 2019-12-24 00:53:09
问题 So what it appears there is a filed bug for swift relating to the CoreFoundation types. Based on the description it appears there is not type checking for CGPath and CGColor, below is a snippet from the bug that demonstrates the behavior. func check(a: AnyObject) -> Bool { return a is CGColor } check("hey") --> true check(1.0) --> true check(UIColor.redColor()) --> true And here is what I'm trying to do if let value = self.valueForKeyPath(keyPath) { if let currentValue = value as? CGColor { /

Cocoa focus ring color animation

只谈情不闲聊 提交于 2019-12-24 00:24:56
问题 I want to use a focus ring animation as an indicator of incorrect data in field. So I'm sending becomeFirstResponder: to field and want focus ring to fade from red to default color. I'm wrestling with Core Animation but still have not found any way to do it. Is it possible? 回答1: I'm not sure if this strategy follows the HIG, its often more common to do something like display a persistent icon indicating a field doesn't validate next to the field, but it shouldn't be too hard to get the effect

Particle animation for iOS

强颜欢笑 提交于 2019-12-23 23:31:10
问题 I'm in need of particle animation in my UIView -based 2D game. At present I'm using an array of images for particle animations. This makes my app size increase, and sometimes leads to memory leaks. Is there is any way to make particle animations using Core Animation? 回答1: cocos2d (see http://cocos2d-iphone.org/) is a framework for developing 2d games for iPhone. The source code for many examples include some particle animation demo's. 回答2: There are some nice examples how to do this in the

How do you run Core Animation and Core Image together on the CPU?

给你一囗甜甜゛ 提交于 2019-12-23 22:25:58
问题 Apple's Core Image Programming Guide, under the section "Getting the Best Performance" says Avoid Core Animation animations while rendering CIImage objects with a GPU context. If you need to use both simultaneously, you can set up both to use the CPU. Can anyone explain this statement? Why it would be more efficient to run Core Animation and Core Image together on the CPU, rather than using the GPU? How do you set up Core Animation to run on the CPU? 回答1: I had the same question and came

Unable to disable animation of CALayer>>removeFromSuperlayer

三世轮回 提交于 2019-12-23 21:15:56
问题 I wish to remove a CALayer from its superlayer without animating. What happens here is the layer animates to a position, works great, when however the animation stopped, this code is executed, which returns the layer to its start position, and fades out; presumably then gets removed from the superlayer. How may it be stopped from animating -removeFromSuperlayer ? The code listed here has the same behavior for all variations of the included comments being uncommented and not uncommented,

is Open GL a Overkill for a 2d Card Game?

孤街醉人 提交于 2019-12-23 19:20:18
问题 I was just have an idea of creating a card game and I was just thinking whether to use OpenGl or CoreAnimation.Can you please tell me whether it would be a bit of a overkill to use OpenGL for s 2D card game.Thanks :) 回答1: It's hard to say without knowing more. You can get pretty far using CALayers, images or drawing with quartz for the cards though. It really depends on the level of visual effects you are considering. If it's just moving cards around, then I'd say use layers. 回答2: Might want

For iPad / iPhone apps, how to have an array of points?

僤鯓⒐⒋嵵緔 提交于 2019-12-23 12:46:08
问题 We can have an NSMutableArray object, and add objects to it. But CGPoint is not an object... are there Point objects suitable to be added to an NSMutableArray object? I see some code using NSStringFromCGPoint to create an NSString object so that it can be added to the array, and later use CGPointFromString to get the CGPoint back... but that just looks too much of a hack... 回答1: You can store the points in the array using NSValue as a wrapper: CGPoint a = CGPointMake(10.0, 10.0); [array