Question

I need to draw a circle with a gradient that starts with red and ends with blue. It should look like this one

How to create such circle is explained here. But I have no idea how to draw such gradient. The problem is that the start color and end color are mixed. Can you help me?

Was it helpful?

Solution

The second image, as @Putz1103 said, is just a linear gradient with a mask.

But what you are trying to do (as the first image suggests) is an angle gradient, not a circular gradient.

Here is an image of the three gradients with the same colors: linear, radial, angle: enter image description here

Unfortunately CoreGraphics doesn't provide a way to create an angle gradient. But you could fake it in another way, like drawing small shapes with different colors around a circle. Here is how: https://stackoverflow.com/a/12775798/942420

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top