Skip to content

Instantly share code, notes, and snippets.

@quephird
Created November 8, 2013 03:54
Show Gist options
  • Save quephird/7366052 to your computer and use it in GitHub Desktop.
Save quephird/7366052 to your computer and use it in GitHub Desktop.
Another attempt at recreating someone else's rendering: https://twitter.com/LorenBednar/status/398197871427600384
(ns cool-result-though
(: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-loop)
(stroke-cap :round)
(ellipse-mode :center)
)
(defn draw []
(let [rows 16
columns 16
space 5
outer-width (/ (- screen-w (* columns space)) columns)
inner-width (* outer-width 0.4)]
(translate space space)
(doseq [r (range rows)]
(push-matrix)
(doseq [c (range columns)]
(apply fill (rand-color))
(rect 0 0 outer-width outer-width)
(apply fill (rand-color))
(rect outer-width outer-width (- inner-width) (- inner-width))
(stroke-weight 2)
(apply stroke (rand-color))
(line 0 0 outer-width outer-width)
(no-stroke)
(translate (+ outer-width space) 0)
)
(pop-matrix)
(translate 0 (+ outer-width space))
)
)
(save "cool-result-though.png")
)
(sketch
:title "cool-result-though"
:setup setup
:draw draw
:size [screen-w screen-h]
:renderer :java2d
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment