Skip to content

Instantly share code, notes, and snippets.

@samaaron
Created May 9, 2012 19:28
Show Gist options
  • Save samaaron/2648205 to your computer and use it in GitHub Desktop.
Save samaaron/2648205 to your computer and use it in GitHub Desktop.
Vanishing Point circles
;;requires:
;; * Quil 1.4.1
;; * Clojure 1.4
;;
;; This is a modified version of @quephird's original code:
;; https://gist.github.com/2647426
(ns vanishing-point-circles
(:use quil.core))
(def sketch-width 1500)
(def sketch-height 900)
(def circle-d 30)
(def n-rows (+ 3 (quot sketch-width circle-d)))
(def n-cols (inc (quot sketch-height circle-d)))
(defn- random-rgb []
[(random 127) (+ 127 (random 127)) 4])
(defn- random-row-col []
(map #(Math/floor %) [(random n-rows) (random n-cols)]))
(defn setup []
(smooth)
(background 0))
(defn draw-all-at-once []
(rotate (/ (mod (frame-count) 3) 2))
(doseq [r (range n-rows)
c (range n-cols)]
(apply stroke (random-rgb))
(stroke-weight 2)
(apply fill (random-rgb))
(ellipse (cond (zero? (mod c 2)) (* r circle-d) :else (* (+ r 0.5) circle-d))
(* c circle-d)
circle-d
circle-d)))
(defsketch main
:title "Vanishing Point Circles"
:setup setup
:draw draw-all-at-once
:size [sketch-width sketch-height]
:target :perm-frame)
;;once the sketch is running, execute this code:
(comment
(doseq [i (range 30 0 -1)]
(Thread/sleep 500)
(def circle-d i)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment