Skip to content

Instantly share code, notes, and snippets.

@quephird
Created November 6, 2013 22:48
Show Gist options
  • Select an option

  • Save quephird/7345628 to your computer and use it in GitHub Desktop.

Select an option

Save quephird/7345628 to your computer and use it in GitHub Desktop.
(ns builder-issues
(:use quil.applet)
(:use quil.core))
(def screen-w 800)
(def screen-h 800)
(defn- rand-color []
(repeatedly 3 (fn [] (rand-int 255))))
(defn- setup []
(background 0)
(smooth)
(no-stroke)
(no-loop)
(ellipse-mode :center)
)
(defn draw []
(let [rows 20
columns 8
outer-radius 150
ring-width 30
inner-radius (- outer-radius ring-width)
delta-x 50
delta-y 40]
(translate (/ outer-radius 2) (/ outer-radius 2))
(doseq [r (range rows)]
(push-matrix)
(doseq [c (range columns)]
(apply fill (rand-color))
(ellipse 0 0 outer-radius outer-radius)
(apply fill (rand-color))
(ellipse 0 0 inner-radius inner-radius)
(translate (- outer-radius delta-x) 0)
)
(pop-matrix)
(translate 0 delta-y)
)
)
(save "builder-issues.png")
)
(sketch
:title "builder-issues"
:setup setup
:draw draw
:size [screen-w screen-h]
:renderer :java2d ; :p2d is awful here and using it results in strange lines in fills.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment