caanimation

Animating between two bezier path shapes

会有一股神秘感。 提交于 2019-12-03 03:58:46
问题 I found it tricky to animate a UIImageView between two states: its original rectangle frame, and a new shape created with a UIBezierPath . There are many different techniques mentioned, most of which did not work for me. First was the realization that using UIView block animation would not work; evidently one can't perform sublayer animations in an animateWithDuration: block. (see here and here) That left CAAnimation , with the concrete subclasses like CABasicAnimation . I soon realized that

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

Animating between two bezier path shapes

荒凉一梦 提交于 2019-12-02 17:21:31
I found it tricky to animate a UIImageView between two states: its original rectangle frame, and a new shape created with a UIBezierPath . There are many different techniques mentioned, most of which did not work for me. First was the realization that using UIView block animation would not work; evidently one can't perform sublayer animations in an animateWithDuration: block. (see here and here ) That left CAAnimation , with the concrete subclasses like CABasicAnimation . I soon realized that one can't animate from a view that doesn't have a CAShapeLayer to one that does (see here , for

How to do a curve/arc animation with CAAnimation?

折月煮酒 提交于 2019-12-02 14:56:52
I have an user interface where an item get deleted, I would like to mimic the "move to folder" effect in iOS mail. The effect where the little letter icon is "thrown" into the folder. Mine will get dumped in a bin instead. I tried implementing it using a CAAnimation on the layer. As far as I can read in the documentations I should be able to set a byValue and a toValue and CAAnimation should interpolate the values. I am looking to do a little curve, so the item goes through a point a bit above and to the left of the items start position. CABasicAnimation* animation = [CABasicAnimation

Need better and simpler understanding of CATransform3D

我们两清 提交于 2019-12-02 14:56:07
Please go through the images. So this is the code which I got from some online source and it does transform my object. Besides that, I understood nothing at all. I am new to CATransform3D and want to know exactly how it works. CATransform3D transform = CATransform3DIdentity; transform.m34 = 1.0 / -500; transform = CATransform3DRotate(transform, 45.0f * M_PI / 180.0f, 0, 1, 0.0f); _bgView.layer.transform = transform; I want to know how did this code run? Why did we set some value in m34? I found that its some kind of matrix which even confuses me more. Also, what do the arguments in the

How can I callback as a CABasicAnimation is animating?

房东的猫 提交于 2019-12-02 08:43:17
I have an animation I'm using to snap a rotatable UIView to a circular grid. As the view animates, I need to update another view based on the rotating views position. How can I go about getting the position of the rotating view as it animates into position? When animation starts you can start a function that will be polling current view position using a timer (I suppose you will need to get presentationLayer from view's layer and get position values from it). There's no callbacks for CAAnimation other than animationDidStart and animationDidStop so it seems that's the solution (if I'm not

Animation Snaps back when the UIImage is changed

三世轮回 提交于 2019-12-02 08:07:51
I have an UIImageView that runs across the screen when a button is pressed and held. When the button is pressed is changes the UIImage of the UIImageView and when the button is let go I change it to its original UIImage. When ever the image changes back it snaps back to the location that the image started. This Timer is called when the button is pressed: //This is the image that changes when the button is pressed. imView.image = image2; runTimer = [NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(perform) userInfo:nil repeats:YES]; This is called When the button stops

Low frame rate during UINavigationController push transition

谁都会走 提交于 2019-12-01 11:35:33
I have a UINavigationController , and push from the root view controller to the next view controller. This second view controller is fairly "heavy", in that it has a great deal of initialization and subviews. My issue is this: the transition animation performs terribly. Basically, the animation suffers from a very low frame rate (I get maybe 3-4 frames in total out of the "push" animation). I've tried a variety of different techniques, including two different methods to manually animate the transition. In all cases, the first 0.4-0.7 seconds of the animation suffers from this poor framerate.

Low frame rate during UINavigationController push transition

天大地大妈咪最大 提交于 2019-12-01 09:42:15
问题 I have a UINavigationController , and push from the root view controller to the next view controller. This second view controller is fairly "heavy", in that it has a great deal of initialization and subviews. My issue is this: the transition animation performs terribly. Basically, the animation suffers from a very low frame rate (I get maybe 3-4 frames in total out of the "push" animation). I've tried a variety of different techniques, including two different methods to manually animate the

Rotating CAShapeLayer moves the position too

旧时模样 提交于 2019-12-01 03:11:09
I am creating a CAShapeLayer. I am adding rotation animation to it. Somehow transformation result is weird. The child layer is moving along with rotation. I need it to be in fixed center/position(anchor) and rotate. I know its messing up geometric transformation but i am unable to get it right. I have tried setting anchorpoint. I also followed this post Here is the code: UIBezierPath *circle = [UIBezierPath bezierPathWithArcCenter:CGPointMake(75, 125) radius:50 startAngle:0 endAngle:1.8 * M_PI clockwise:YES]; CAShapeLayer *circleLayer = [CAShapeLayer layer]; [circleLayer setFrame:CGRectMake