Radial gradient, is the circular gradient, from the center (or the smaller concentric circle) began to diffuse the effect of the gradient, listening to some abstraction, look down to see the picture immediately understand. The linear gradient specifies the start and end points, and the radial gradient specifies the center and radius of the beginning end of the garden. This createRadialGradient
is used to get the canvas's Canvasgradient object, so the addColorStop
method is also generic.
This is the definition of the
Context.createradialgradient (X0,Y0,R0,X1,Y1,R1);
Parameters |
Description |
X0 |
The x-coordinate of the beginning circle of the gradient |
Y0 |
The y-coordinate of the start circle of the gradient |
R0 |
The radius of the start circle |
X1 |
The x-coordinate of the end circle of the gradient |
Y1 |
The y-coordinate of the end circle of the gradient |
R1 |
End radius of Circle |
What happens if the two circle positions are different?
1. cycle1 < Cycle2 + Cycle1 in Cycle2 + cycle1 with Cycle2 Center coincident
2. Cycle1 < Cycle2 + Cycle1 in Cycle2 +cycle1 with the center of Cycle2 does not coincide
3. Cycle1 > Cycle2 + cycle2 in Cycle1 +cycle1 with the center of Cycle2 does not coincide
4. Cycle1 < Cycle2 + Cycle1 and Cycle2
5. Cycle1 > Cycle2 + cycle1 and Cycle2
6. Cycle1 = = Cycle2 + cycle1 and Cycle2
7. Cycle1 = = Cycle2 + cycle1 intersect with Cycle2
Conclusion
Other things are not listed, here is enough to explain the problem. The gradient pattern obtained by two of these circles is magical. Well, and then got a inconclusive conclusion--createradialgradient the principle of linear gradients is that the area in which the gradient occurs is that the points on the cycle1 are connected to the points on the cycle2, and they consist of the stereoscopic shape that is observed at an angle. So when two circles are absent, a radial fan is formed. May be a little difficult to understand, put two of the circle in three-dimensional scene, it is easy to understand.
The above is an excerpt of the work of others recorded is easy to learn so there are similarities are I copy you
Canvas createradialgradient Usage