diff --git a/2021/sketch_2021_01_25b/sketch_2021_01_25b.png b/2021/sketch_2021_01_25b/sketch_2021_01_25b.png new file mode 100644 index 00000000..b43562c7 Binary files /dev/null and b/2021/sketch_2021_01_25b/sketch_2021_01_25b.png differ diff --git a/2021/sketch_2021_01_25b/sketch_2021_01_25b.pyde b/2021/sketch_2021_01_25b/sketch_2021_01_25b.pyde new file mode 100644 index 00000000..2af98796 --- /dev/null +++ b/2021/sketch_2021_01_25b/sketch_2021_01_25b.pyde @@ -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)) diff --git a/README.md b/README.md index 45e0c7ee..26b1a7fa 100644 --- a/README.md +++ b/README.md @@ -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)]