Alexandre B A Villares 2021-01-26 00:59:51 -03:00
rodzic 65f909e9f7
commit 60ca4b8b43
3 zmienionych plików z 44 dodań i 0 usunięć

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 256 KiB

Wyświetl plik

@ -0,0 +1,38 @@
from itertools import product, permutations
BORDER = 100
SIZE = 60
def setup():
global grid
size(680, 680)
grid = list(product(range(BORDER, width - BORDER + 1, SIZE),
range(BORDER, height - BORDER + 1, SIZE)))
colors = (hex_color('#264653'),
hex_color('#2a9d8f'),
hex_color('#9c46a'),
hex_color('#f4a261'),
hex_color('#e76f51'))
perms = list(permutations(colors, 3))
print(len(perms))
for i, (x, y) in enumerate(grid):
if i < len(perms):
for j, c in enumerate(perms[i]):
fill(c)
circle(x, y, SIZE - j * 10)
def hex_color(s):
"""
This function allows you to create color from a string with hex notation in Python mode.
On "standard" Processing (Java) we can use hexadecimal color notation #AABBCC
On Python mode one can use this notation between quotes, as a string in fill(),
stroke() and background(), but, unfortunately, not with color().
"""
if s.startswith('#'):
s = s[1:]
return color(int(s[:2], 16), int(s[2:4], 16), int(s[4:6], 16))

Wyświetl plik

@ -26,6 +26,12 @@ Here are listed some of the tools I have been using:
---
![sketch_2021_01_25b](2021/sketch_2021_01_25b/sketch_2021_01_25b.png)
[sketch_2021_01_25b](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_01_25b) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
---
![sketch_2021_01_24c](2021/sketch_2021_01_24c/sketch_2021_01_24c.png)
[sketch_2021_01_24c](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_01_24c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]