Created
September 1, 2020 01:37
-
-
Save cieloazul310/95848cc3ffcd03f9b97e705b26688acc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def w 20) | |
(def h (/ w 2)) | |
(def items 4) | |
(def size (* w items)) | |
(def r (/ w (sqrt 3))) | |
(def cyan "#00FFFF") | |
(def magenta "#FF00FF") | |
(def yellow "#FFFF00") | |
(def black "#000000") | |
(defn color [i] | |
(case (mod i 4) | |
0 cyan | |
1 magenta | |
2 yellow | |
3 black | |
) | |
) | |
(defn hoge [x y i] (transform | |
(mat2d/* | |
(translate [ | |
(if (even? (floor (/ i (+ items 1)))) x (+ x h)) | |
y | |
]) | |
) | |
(style (fill (color i)) | |
(circle [0 0] 1) | |
) | |
)) | |
(def canvas (rect [0 0 size size])) | |
(artboard | |
{:bounds [0 0 size size] | |
:background "#fff"} | |
(for [y (column 0 items w) x (column 0 items w) :index i] | |
(hoge x y i) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment