A CAGradientLayer has two properties startPoint and endPoint. These properties are defined in terms of the unit coordinate space. The result is that if I have two gradient layers with the same start and end points each with different bounds, the two gradients will be different.
How can the startPoint and endPoint of a CAGradientLayer layer be defined not in terms of the unit coordinate space but in standard point coordinates so that the angle/size of the gradient is not effected by the bounds of the layer?
The desired result is that a gradient layer can be resized to any size or shape and the gradient remain in place, although cropped differently.
Qualifications: I know that this seems like an absolutely trivial transformation between coordinate spaces, but apparently either, yes I am in fact that dumb, or perhaps there's something either broken or extremely counter-intuitive about how CAGradientLayers work. I haven't included an example of what I expect should be the right way to do it, because (assuming I'm just dumb) it would only be misleading.
Aucun commentaire:
Enregistrer un commentaire