Created
May 9, 2012 19:28
-
-
Save samaaron/2648205 to your computer and use it in GitHub Desktop.
Vanishing Point circles
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
;;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