Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用动画更改组合路径部分的填充颜色?_Ios_Animation_Uibezierpath_Cashapelayer_Cgpath - Fatal编程技术网

Ios 使用动画更改组合路径部分的填充颜色?

Ios 使用动画更改组合路径部分的填充颜色?,ios,animation,uibezierpath,cashapelayer,cgpath,Ios,Animation,Uibezierpath,Cashapelayer,Cgpath,简单地说,在某些活动中,只有我的图标的一部分必须改变颜色 我在ui视图中绘制了一个带有曲线的图标。这幅画沸腾了 具体到将多条路径组合在一起,如下所示(swift代码): 然后我向UIView添加这样的组合路径(obj-c,抱歉 组合): 现在,在某个时间点,我想改变 只有一个带动画的bezierPath。如何执行此操作?您可以清洁当前遮罩,使用笔划/填充颜色重新绘制任何bezierpath,并将它们组合在一起,然后重新设置。对于绘制动画,您可以参考您可以清洁当前遮罩,并使用笔划/填充颜色重新绘制

简单地说,在某些活动中,只有我的图标的一部分必须改变颜色

我在
ui视图
中绘制了一个带有曲线的图标。这幅画沸腾了 具体到将多条路径组合在一起,如下所示(swift代码):

然后我向UIView添加这样的组合路径(obj-c,抱歉 组合):

现在,在某个时间点,我想改变
只有一个带动画的
bezierPath
。如何执行此操作?

您可以清洁当前遮罩,使用笔划/填充颜色重新绘制任何bezierpath,并将它们组合在一起,然后重新设置。对于绘制动画,您可以参考

您可以清洁当前遮罩,并使用笔划/填充颜色重新绘制任何bezierpath,并将它们组合在一起,然后再次设置。对于绘制动画,您可以参考

一个很好的方法是使用CAShapeLayer,您可以使用它在动画中更改其填充颜色。请参考此答案:一个很好的方法是使用CAShapeLayer,您可以使用它在动画中更改其填充颜色。请参阅以下答案:
let combinedPath = CGPathCreateMutableCopy(bezierPath.CGPath)
CGPathAddPath(combinedPath, nil, bezier2Path.CGPath);
CGPathAddPath(combinedPath, nil, bezier3Path.CGPath);
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.frame = self.bounds;
shapeLayer.path = combinedPath;
self.layer.mask = shapeLayer;