Masking the CAGradientLayer to the CAShape level

Help Needed: I am having a problem creating a gradient filled shape. To create the shape, I use the CAShape layer and mask it with CGPath showing an arrow. It works. However, I can only mask the CAGradient layer if I set its frame to the same size as the view the layer is attached to. This leads to the effect shown below: Shape

I only get part of the gradient I want to fill the shape layer. I have included a picture below to show the intended shape compared to the one currently created.  arrows with gradients

Any news? Thank!

+3


source to share





All Articles