Created
May 9, 2012 18:09
-
-
Save quephird/2647491 to your computer and use it in GitHub Desktop.
red circles with quil
This file contains 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 red-circles | |
(:use quil.core)) | |
(def *screen-x* 1920) | |
(def *screen-y* 1080) | |
(def *circle-d* 64) | |
(def *rows* (+ 3 (quot *screen-x* *circle-d*))) | |
(def *cols* (inc (quot *screen-y* *circle-d*))) | |
(defn- random-rgb [] | |
[(random 255) 0 0]) | |
(defn- random-row-col [] | |
(map #(Math/floor %) [(random *rows*) (random *cols*)])) | |
(defn setup [] | |
(smooth) | |
(background 0) | |
(no-loop)) | |
(defn draw-all-at-once [] | |
(doseq [r (range *rows*) c (range *cols*)] | |
(apply stroke (random-rgb)) | |
(stroke-weight 10) | |
(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*)) | |
(save "red-circles.png")) | |
(defsketch main | |
:title "Circles" | |
:setup setup | |
:draw draw-all-at-once | |
:size [*screen-x* *screen-y* ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment