Principle and drawing method of rainbow

    As long as there are tiny water droplets in the air, rainbow phenomena can occur. When sunlight illuminates the micro water droplets at a low horizontal angle, it will be refracted, and then reflected by the mirror surface of the water droplets to form a rainbow. In fact, the rainbow has countless colors, but when the sun shines, we can only see seven different colors from the outside to the inside: red, orange, yellow, green, cyan, blue, and purple.
    Rainbows often appear when the sky turns fine after rain. At this time, there will be many small water droplets in the air, similar to a micro lens. When sunlight encounters a tiny water drop (micro lens), it will produce refraction. The refractive index of light of different frequencies in water is different, namely The refraction angle is also different, forming a curved curve with multiple colors. Then, the refracted light of different frequencies is reflected by the mirror surface of the water droplet to form a continuous curved bridge-shaped curve.

    Common colors of the rainbow: red, orange, yellow, green, blue, blue and purple, these 7 kinds.
    The following introduces how to draw a rainbow with arcs of 7 colors in Scratch.

1. Define the "Drawing Arc" building block

Figure (1) Define the "drawing arc" building block

Figure (2) "Draw arc" building block code

2. Define the "rainbow" building block

Figure (3) Define the "Rainbow" building block

Figure (4) "Rainbow" building block code

4. Import 2 cloud roles

    Click Scratch --> select a role —> Cloud --> OK,
    click Scratch --> select a role —> Cloud --> OK.

5. Main function

Figure (5) Main function

    The effect is as follows:

Figure (6) Rainbow rendering

Guess you like

Origin blog.csdn.net/sanqima/article/details/113813591