Skip to content

Instantly share code, notes, and snippets.

@pascalc
Last active December 28, 2015 12:19
Show Gist options
  • Save pascalc/7500230 to your computer and use it in GitHub Desktop.
Save pascalc/7500230 to your computer and use it in GitHub Desktop.
Moths
(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