Color wheel: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Sidef}}: Fix link: Perl 6 --> Raku) |
(Added Processing Python task) |
||
Line 401: | Line 401: | ||
main()</lang> |
main()</lang> |
||
=={{header|Processing_Python}}== |
|||
<lang python> |
|||
size(300, 300) |
|||
background(0) |
|||
radius = min(width, height) / 2.0 |
|||
cx, cy = width / 2, width / 2 |
|||
for x in range(width): |
|||
for y in range(height): |
|||
rx = x - cx |
|||
ry = y - cy |
|||
s = ((x - cx) ** 2.0 + (y - cy) ** 2.0) ** 0.5 / radius |
|||
if s <= 1.0: |
|||
h = ((atan2(ry, rx) / PI) + 1.0) / 2.0 |
|||
colorMode(HSB) |
|||
c = color(int(h * 255), int(s * 255), 255) |
|||
set(x, y, c) |
|||
</lang> |
|||
=={{header|Python}}== |
=={{header|Python}}== |