CALayer动画和颜色混合

The*_*ude 5 core-animation core-graphics ios

我正在使用CAShapeLayer生成一些形状.实际上我有4个CAShapeLayers代表屏幕中的一些三角形.我使用CGMutablePathRef创建形状并设置每个CAShapeLayer的path属性.三角形在不同的形状层中,因为我必须以不同的方式为每个三角形设置动画.

我使用CABasicAnimation在我的viewcontroller上执行一些动画,并动画化CAShapeLayer的path属性,如:

CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@”path”];
animation.duration = 2.0;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.repeatCount = 1e100f;
animation.autoreverses = YES;
animation.fromValue = (id)initialPath;
animation.toValue = (id)newPath;
[shapeLayer addAnimation:animation forKey:@”animatePath”];
Run Code Online (Sandbox Code Playgroud)

没关系,我可以绘制形状并为它们制作动画.我的问题是,这使用默认的alpha混合(result =(alpha*foreground)+(1 - alpha)*background)混合图像.我想要的是使用乘法混合(kCGBlendModeMultiply),但我不知道如何混合CAShapeLayer绘图和混合模式.我已成功绘制我的形状创建自定义UIView并覆盖drawRect方法,但后来我无法为形状设置动画.

有没有人有成功改变CAShapeLayer的颜色混合?