Created
November 6, 2013 22:48
-
-
Save quephird/7345628 to your computer and use it in GitHub Desktop.
Inspired by this Twitter post: https://twitter.com/LorenBednar/status/398200950969483264/
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 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