草庐IT

cabasicanimation

全部标签

iphone - 使用 CABasicAnimation 为 Circle 的 endAngle 设置动画

我有一些带有drawrect代码的UIView用于绘制饼图:-(void)drawRect:(CGRect)rect{CGRectparentViewBounds=self.bounds;CGFloatx=CGRectGetWidth(parentViewBounds)/2;CGFloaty=CGRectGetHeight(parentViewBounds)/2;//GetthegraphicscontextandclearitCGContextRefctx=UIGraphicsGetCurrentContext();CGContextClearRect(ctx,rect);//def

ios - CABasicAnimation 在完成 1 个循环后回到原来的位置

不要引用CABasicAnimationreturnstotheoriginalpositionbeforethenextanimation和Objective-C-CABasicAnimationapplyingchangesafteranimation?和CABasicAnimationrotatereturnstooriginalposition我试过了。belowcodedoes,bottom->top->goesleft->backtoit’soriginalposition.bottom->top->goesleft->backtoitsoriginalposition.I

ios - 在 CABasicAnimation 动画时放慢它

有没有办法在动画时改变重复的CABasicAnimation的值?所以我有以下摇动动画:CABasicAnimation*shake=[CABasicAnimationanimationWithKeyPath:@"position"];[shakesetDuration:0.05];[shakesetRepeatCount:130];[shakesetAutoreverses:YES];[shakesetFromValue:[NSValuevalueWithCGPoint:CGPointMake([clockcenter].x-12.0f,[clockcenter].y)]];[sha

ios - CABasicAnimation - 在暂停期间更改动画起始值

为了在360度旋转圆圈,我使用CABasicAnimation,以这种方式:funcstartRotate(from:Double){letrotation:CABasicAnimation=CABasicAnimation(keyPath:"transform.rotation.z")rotation.fromValue=fromrotation.toValue=NSNumber(value:M_PI*2-from)rotation.duration=10rotation.isCumulative=truerotation.repeatCount=1self.cdImage.laye

ios - 按下主页按钮时 CABasicAnimation 消失

我正在实现一个游戏,其中我有一些CABasicAnimations。例如,像这样:CABasicAnimation*borddroit=[CABasicAnimationanimationWithKeyPath:@"transform.translation.x"];borddroit.fromValue=[NSNumbernumberWithFloat:0.0f];borddroit.toValue=[NSNumbernumberWithFloat:749.0f];borddroit.duration=t;borddroit.repeatCount=1;[ImageSuivante2

ios - 使用 CABasicAnimation 停止旋转图像

我有一个使用以下代码旋转的UIImageView:CABasicAnimation*rotation;rotation=[CABasicAnimationanimationWithKeyPath:@"transform.rotation"];rotation.fromValue=[NSNumbernumberWithFloat:0];rotation.toValue=[NSNumbernumberWithFloat:(2*M_PI)];rotation.duration=2.0;rotation.repeatCount=HUGE_VALF;[myView.layeraddAnimati

iphone - 为什么我不能在 CABasicAnimation 完成后设置图层的不透明度?

我有一个名为specialLayer的View。不透明度的隐式动画被禁用,如下所示:self.specialLayer.actions=[NSDictionarydictionaryWithObjectsAndKeys:[NSNullnull],@"opacity",nil];只有两种方法可以访问这个子层。-(void)touchDown{self.specialLayer.opacity=0.25f;}-(void)touchUp{CABasicAnimation*animation=[CABasicAnimationanimationWithKeyPath:@"opacity"];

iphone - 如何检查 CABasicAnimation 是否已应用并正在运行?

我创建了一个CABasicAnimation并将其应用到如下图层:[rotatedLayeraddAnimation:rotationAnimationforKey:@"transform.rotation.z"];如何检查rotatedLayer是否已经在transform.rotation.z路径上设置动画? 最佳答案 检查[rotatedLayeranimationForKey:@"transform.rotation.z"];的返回值。 关于iphone-如何检查CABasicA

iphone - 在旋转 iPhone 时修改 CABasicAnimation

我有一个使用CABasicAnimation旋转的uiimage。当我获得指南针更新时,我会根据时间偏移更改/更新图像起点。这很好用,但是当我从指南针获得更新并删除旧动画时,它会跳回到开始位置,然后再移动到新的开始位置。这会导致闪烁效果。是否可以同时删除和添加动画或以某种方式防止这种情况发生?到目前为止,我的代码如下。[self.waveImage.layerRemoveAllAnimations];CABasicAnimation*animation=[CABasicAnimationanimationWithKeyPath:@"transform.rotation.z"];anim

ios - 使用负速度恢复 CABasicAnimation?

我使用以下代码恢复我的CABasicAnimation:CFTimeIntervalpausedtime=layer.timeOffset;layer.speed=1.0;layer.timeOffset=0.0;layer.beginTime=[layerconvertTime:CACurrentMediaTime()toLayer:nil]-pausedTime;这很简单。在this的最后文章作者指出,负speed值动画反转。我不明白在这种情况下timeOffset和beginTime应该是什么样子?P.S.我知道我可以通过从表示层获取当前值并设置toValue和fromValue