-
-
Save fogus/5889084 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(ns circles.core | |
(:require [quil.core :as q])) | |
; "hello world" for Quil meets http://bit.ly/18luJO2 | |
(def the-width 808) | |
(def the-height 500) | |
(defn random-x-y [] | |
(list (int (rand the-width)) | |
(int (rand the-height)))) | |
(defn circle [xy] | |
(q/stroke 171 163 225) | |
(q/stroke-weight 5) | |
(q/fill 213 209 240) | |
(let [diam (+ 50 (q/random 100)) | |
x (first xy) | |
y (second xy)] | |
(q/ellipse x y diam diam))) | |
(defn log-xy [a-list] | |
(println (str "x: " (first a-list) " " | |
"y: " (second a-list)))) | |
(defn setup [] | |
(q/smooth) | |
(q/frame-rate 20) | |
(q/background 0) | |
(let [xy (random-x-y)] | |
; this totally works | |
(circle (random-x-y))) | |
; this totally fails | |
(doall (map circle (list (random-x-y) (random-x-y)))) | |
) | |
(defn draw [] ()) | |
(q/defsketch example | |
:title "Circles" | |
:setup setup | |
:draw draw | |
:size [the-width the-height]) | |
(defn -main [] ()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment