Created
October 19, 2012 20:51
-
-
Save quephird/3920653 to your computer and use it in GitHub Desktop.
filling-time-inspiration
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 filling-time-inspiration | |
(:use quil.core)) | |
(def screen-w 1920) | |
(def screen-h 1080) | |
(def background-color [0 0 0]) | |
(def ellipses-per-ring 14) | |
(def slices-per-ellipse 7) | |
(defn setup [] | |
(apply background background-color) | |
(smooth) | |
(no-stroke) | |
(no-loop) | |
(no-fill) | |
(ellipse-mode :center) | |
) | |
(defn- draw-slices [slices-per-ellipse ellipse-color y semi-minor-axis] | |
(apply stroke (map #(* 0.8 %) ellipse-color)) | |
(stroke-weight 1) | |
(fill 0) | |
(push-matrix) | |
(translate 0 y) | |
(let [angle (/ 360 slices-per-ellipse)] | |
(doseq [idx (range slices-per-ellipse)] | |
(let [a (* 0.8 semi-minor-axis) | |
b (* 2.2 a) | |
slice-angle (* idx angle) | |
left-slice-x (* a (Math/cos (radians (- slice-angle 18)))) | |
left-slice-y (* b (Math/sin (radians (- slice-angle 18)))) | |
right-slice-x (* a (Math/cos (radians (+ slice-angle 18)))) | |
right-slice-y (* b (Math/sin (radians (+ slice-angle 18))))] | |
(begin-shape) | |
(curve-vertex 0 0) | |
(curve-vertex 0 0) | |
(curve-vertex left-slice-x left-slice-y) | |
(curve-vertex right-slice-x right-slice-y) | |
(curve-vertex 0 0) | |
(curve-vertex 0 0) | |
(end-shape) | |
) | |
) | |
) | |
(pop-matrix) | |
) | |
(defn- draw-ellipse-ring [starting-angle c w y minor-axis] | |
(push-matrix) | |
(rotate (radians starting-angle)) | |
; Thick dark outer ring with fill | |
(apply stroke (map #(* 0.5 %) c)) | |
(stroke-weight w) | |
(apply fill (map #(* 0.2 %) c)) | |
(doseq [_ (range ellipses-per-ring)] | |
(ellipse 0 y minor-axis (* 2 minor-axis)) | |
(rotate (radians (/ 360 ellipses-per-ring))) | |
) | |
; Thin bright inner ring with detail | |
(apply stroke c) | |
(doseq [_ (range ellipses-per-ring)] | |
(no-fill) | |
(stroke-weight 4) | |
(ellipse 0 y (- minor-axis w) (- (* 2 minor-axis) w)) | |
(rotate (radians (/ 360 ellipses-per-ring))) | |
(draw-slices slices-per-ellipse c y (* minor-axis 0.45)) | |
) | |
(pop-matrix) | |
) | |
(defn draw [] | |
(translate (/ screen-w 2) (/ screen-h 2)) | |
(doseq [parms | |
[[0 [242 50 45] 15 200 75] | |
[13 [255 127 0] 10 290 50] | |
[4 [214 175 134] 8 325 40] | |
[-4 [214 175 134] 8 325 40] | |
[10 [238 222 206] 8 375 30] | |
[-10 [238 222 206] 8 375 30] | |
[5 [175 165 153] 8 395 25] | |
[-5 [175 165 153] 8 395 25] | |
[0 [136 118 106] 8 390 30] | |
[13 [120 70 63] 4 410 15] | |
[8 [160 85 75] 4 425 20] | |
[-8 [160 85 75] 4 425 20] | |
[2.5 [107 68 63] 4 425 15] | |
[-2.5 [107 68 63] 4 425 15] | |
[10.5 [140 60 60] 1 425 15] | |
[-10.5 [140 60 60] 1 425 15] | |
[5 [90 30 30] 1 435 12] | |
[-5 [90 30 30] 1 435 12] | |
[3 [80 20 20] 1 450 10] | |
[-3 [80 20 20] 1 450 10] | |
[7 [120 70 70] 1 460 10] | |
[-7 [120 70 70] 1 460 10] | |
[5 [145 80 80] 4 470 20] | |
[-5 [145 80 80] 4 470 20] | |
[2 [120 70 63] 4 480 20] | |
[-2 [120 70 63] 4 480 20] | |
[15 [120 70 63] 4 470 20] | |
[11 [120 70 63] 4 470 20] | |
[4 [175 165 153] 8 525 25] | |
[-4 [175 165 153] 8 525 25] | |
[13 [175 165 153] 8 520 30] | |
[8 [238 222 206] 8 525 45] | |
[-8 [238 222 206] 8 525 45] | |
[0 [238 222 206] 8 535 35] | |
[4 [214 175 134] 10 625 70] | |
[-4 [214 175 134] 10 625 70] | |
[13 [255 127 0] 15 685 125] | |
[0 [255 42 42] 30 1200 475] | |
]] | |
(apply draw-ellipse-ring parms)) | |
(save "filling-time.png") | |
) | |
(defsketch main | |
:title "inspiration from Filling Time by `SuicideBySafetyPin" | |
: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