Canvas createradialgradient Usage

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.