cabasicanimation

Flickering in CABasicAnimation for rotation

懵懂的女人 提交于 2019-12-11 12:51:46
问题 I am trying to rotate a CAShapeLayer by an angle from its current angle whenever a button is pressed. I am using delegate function animationDidStop to set the transform of the layer during end of animation, since I have noticed animation only changes the transform of the presentation layer and not the layer in itself. But there are random flickering in the animation which seems to be during the end of the animation when the animation is complete due to layer going back to its previous

CABasicAnimation resets when edge swiping with UINavigationController

徘徊边缘 提交于 2019-12-11 10:11:25
问题 I have the following CABasicAnimation run in my viewDidLoad for a view controller inside a UINavigationController : CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.duration = 1; animation.additive = NO; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; animation.fromValue = [NSNumber numberWithFloat:0]; animation.toValue = [NSNumber numberWithFloat:-1*(((-windBearing+180) * M_PI) / 180)]; [compass.layer

Endless repeating scrolling/animated background in iOS?

送分小仙女□ 提交于 2019-12-11 09:18:57
问题 I'm stuck on animating 2 images that scroll on the iPhone view horizontally infinitely. The background can not have any gaps in it. If this can be done with just 1 image that would be great but I can't seem to get it. Here's the code I have so far: -(void)moveImages { CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; theAnimation.duration=10; theAnimation.repeatCount=100; theAnimation.autoreverses=NO; theAnimation.fromValue=

CABasicAnimation back to its original position after it finish it's 1 cycle

假装没事ソ 提交于 2019-12-11 04:14:52
问题 Don't refer CABasicAnimation returns to the original position before the next animation and Objective-C - CABasicAnimation applying changes after animation? and CABasicAnimation rotate returns to original position i have tried. below code does,bottom->top->goes left->back to it’s original position. bottom->top->goes left->back to its original position. I need bottom->top->goes left.bottom->top->goes left so on… -(void)addUpDownAnimationForButton:(UILabel*)label { CABasicAnimation *

CAShapeLayer detect touch during animation Swift

三世轮回 提交于 2019-12-11 03:17:59
问题 I can detect a touch of a CAShapeLayer like this (touchesEnded): let touchLocation : CGPoint = (touch as! UITouch).locationInView(self.view) for shape in shapes{ if CGPathContainsPoint(shape.path, nil, touchLocation, false){ print("Layer touch") } } And I can animate the path of a CAShapeLayer like this: let newShapePath = UIBezierPath(arcCenter: toPoint, radius: 20, startAngle: CGFloat(0), endAngle: CGFloat(M_PI * 2), clockwise: true).CGPath // animate the `path` let animation =

CAShapeLayer’s strokeEnd doesn’t animate

筅森魡賤 提交于 2019-12-11 01:52:03
问题 This is the code I’m using to animate my CAShapeLayer : _progressBarLayer.strokeEnd = CGFloat(_progressToDrawForProgress(progress)) let progressAnimation = CABasicAnimation(keyPath: "strokeEnd") progressAnimation.duration = CFTimeInterval(1.0) progressAnimation.fromValue = CGFloat(self.progress) progressAnimation.toValue = _progressBarLayer.strokeEnd progressAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) _progressBarLayer.addAnimation(progressAnimation,

how to animation a label on circular path in iOS?

烂漫一生 提交于 2019-12-09 07:54:02
问题 I am stuck at animating the uiLabel in my view. Actually I just want to animate my label/Text on a circular path. I have searched a lot over internet but couldn't find any good tutorial or example that is doing something like my problem. I have done CAShapeLayer (circle) increasing from 0 to its maximum value.... Similarly I want that my label/text start moving from initial point in circular path and come back to its initial point after completing one circle. Hope I have explained my problem

Circle to rectangle transformation animation

僤鯓⒐⒋嵵緔 提交于 2019-12-09 07:16:28
问题 I am very new to iOS and I need to do following animation: Transformation of the circle to rectangle should be smooth, but in above animation it's not very smooth. What I did is create a circle and a rectangle using following code in this tutorial: Circle : class OvalLayer: CAShapeLayer { let animationDuration: CFTimeInterval = 0.3 override init() { super.init() fillColor = Colors.red.CGColor path = ovalPathSmall.CGPath } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has

How to get perfect X , Y position of rotating UIView in ios

依然范特西╮ 提交于 2019-12-08 17:00:55
问题 I am using CABasicanimation for rotate an UIView. I am using this code, CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; NSNumber *currentAngle = [CircleView.layer.presentationLayer valueForKeyPath:@"transform.rotation"]; rotationAnimation.fromValue = currentAngle; rotationAnimation.toValue = @(50*M_PI); rotationAnimation.duration = 50.0f; // this might be too fast rotationAnimation.repeatCount = HUGE_VALF; // HUGE_VALF is defined in math

Synchronising image, text, and positioning with CoreAnimation

≡放荡痞女 提交于 2019-12-08 07:17:06
问题 I am a bit of a beginner with animations and have been experimenting with CoreAnimation for a couple of days. Feel free to warn me if this question does not make sense, but I'm trying to achieve the following. I have three objects: one should be an image, moving according to a given pattern one should be an UIImage that swaps two images one should be a text (CATextLayer?) whose content changes The three actions should happen in sync. As an example, think about a programme showing a sinusoid