Last active
December 28, 2015 12:19
-
-
Save pascalc/7500230 to your computer and use it in GitHub Desktop.
Moths
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
(clear!) | |
;; Background | |
(rectangle | |
(width "100%") | |
(height "100%") | |
(fill "#383032") | |
(stroke-width 0)) | |
(defn draw-moth | |
[x y color] | |
(square | |
(position x y) | |
(side 30) | |
(fill color))) | |
(defn rand-pos | |
[] | |
(str (rand-int 100) "%")) | |
(defn rand-moths | |
[num color] | |
(dotimes [_ num] | |
(draw-moth | |
(rand-pos) | |
(rand-pos) | |
color))) | |
;; Dark Moths | |
(rand-moths 20 "#000") | |
(rand-moths 20 "#FFF") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment