草庐IT

cabasicanimation

全部标签

iphone - CABasicAnimation 如何让它变得简单

我目前正在UITableViewCell上使用以下动画:CATransform3DrotationTransform=CATransform3DMakeRotation(1.0f*M_PI,0,0,1.0);CABasicAnimation*rotationAnimation=[CABasicAnimationanimationWithKeyPath:@"transform"];rotationAnimation.toValue=[NSValuevalueWithCATransform3D:rotationTransform];rotationAnimation.duration=0.

ios - 暂停和恢复加载屏幕的 CABasicAnimation?

我已经实现了一个LoadingLayer类,它有一些动画元素(确切地说是2个),这些元素使用CABasicAnimation进行动画处理。现在,这个加载屏幕View在整个应用程序中持续存在。隐藏View会停止所有动画吗?或者让我换个说法:我是否需要担心大量内存,或者这可能会导致延迟?我尝试使用-pauseLayer:和-resumeLayer:方法,但由于我的应用程序中的多线程,它们导致了一些问题。因此是否可以只隐藏和显示加载屏幕及其动画一直运行? 最佳答案 https://developer.apple.com/library/c

objective-c - CABasicAnimation - 设置起始笔画位置

我正在为基本圆的绘图制作动画。这工作正常,除了动画开始绘制在3点钟的位置。有谁知道我怎样才能让它在12点开始?self.circle=[CAShapeLayerlayer];self.circle.fillColor=nil;self.circle.lineWidth=7;self.circle.strokeColor=[UIColorblackColor].CGColor;self.circle.bounds=CGRectMake(0,0,200,200);self.circle.path=[UIBezierPathbezierPathWithOvalInRect:self.circ

ios - 如何获得停止/恢复 CABasicAnimation 工作的解决方案?

我正在使用CABasicAnimation来旋转UIImageView,但我无法恢复暂停的动画。动画开始于viewDidLoad方法:UIImageView*img=[[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"MyImage.png"]];self.myImage=img;[self.viewaddSubview:img];[imgrelease];CABasicAnimation*fullRotation=[CABasicAnimationanimationWithKeyPath:@"transform.rotation

iphone - 依次运行 CABasicAnimation

如何让一个CABasicAnimation在另一个CABasicAnimation完成后运行?换句话说,顺序。我已经添加了第二个动画的开始时间,但是似乎第二个动画没有被执行:CABasicAnimation*appearance=[CABasicAnimationanimationWithKeyPath:@"transform.translation.y"];appearance.duration=0.5;appearance.fromValue=[NSNumbernumberWithFloat:0];appearance.toValue=[NSNumbernumberWithFloa

ios - CABasicAnimation从当前图层位置开始

这是我第二周的Obj-C编程,并且在动画方面面临一些小问题。我使用以下动画:CABasicAnimation*fullRotation=[CABasicAnimationanimationWithKeyPath:@"transform.rotation"];fullRotation.toValue=[NSNumbernumberWithFloat:((360*M_PI)/180)];fullRotation.duration=4;fullRotation.repeatCount=1000;[[sticklayer]addAnimation:fullRotationforKey:@"60

ios - 如何消除我的 CABasicAnimation 中的 "jump"?

使用这段代码:funcrotateTheView(_aView:UIView,inClockwiseDirectionisClockwise:Bool){letmultiplier=(isClockwise?1:-1)letkey=(isClockwise?"Spin":"Rotate")varrotation:CABasicAnimation?rotation=CABasicAnimation(keyPath:"transform.rotation")rotation!.fromValue=Int(0)letmultiplicand=multiplier*2rotation!.toV

ios - 如何使用 CABasicAnimation 在 Swift 中更改圆形动画的起点?

我有一个函数可以绘制一个动画圆圈作为处理栏。我可以从圆圈的底部得到它的动画。但是,我想将起点更改为圆的顶部。我在下面附上了我的代码:funcanimateProgressView(_finishPoint:CGFloat,_stringShowAtEnd:String){progressLabel.text="Rating..."progressLayer.strokeEnd=0.0letanimation=CABasicAnimation(keyPath:"strokeEnd")animation.fromValue=CGFloat(0.0)animation.toValue=CGF

ios - 在 CABasicAnimation 中使用 #keyPath 时,类型 'CGPoint' 没有成员 'x'

我正在尝试使用#keyPath语法来获取CALayer属性来为其设置动画:letmyAnimation=CABasicAnimation.init(keyPath:#keyPath(CALayer.position.x))我收到以下错误:Type'CGPoint'hasnomember'x'我错过了什么? 最佳答案 #keyPath指令需要一个Objective-C属性序列作为争论。CALayer继承自NSObject,但是它的位置property是structCGPoint,它根本不是一个类,不能与键值编码一起使用。但是,CALa

ios - 使用圆形 UIBezierPath 和 CABasicAnimation 为 CAShapeLayer 设置动画

我想在15秒内为一个从0度到360度的圆制作动画。动画很奇怪。我知道这可能是一个开始/结束角度问题,我已经遇到过圆形动画的那种问题,但我不知道如何解决这个问题。varcircle_layer=CAShapeLayer()varcircle_anim=CABasicAnimation(keyPath:"path")funcinit_circle_layer(){letw=circle_view.bounds.widthletcenter=CGPoint(x:w/2,y:w/2)//initialpathletstart_angle:CGFloat=-0.25*360*CGFloat.pi