Skip to content

Instantly share code, notes, and snippets.

@quephird
Created October 11, 2012 04:25
Show Gist options
  • Save quephird/3870159 to your computer and use it in GitHub Desktop.
Save quephird/3870159 to your computer and use it in GitHub Desktop.
saved-inspiration
(ns saved-inspiration
(:use quil.core))
(def screen-w 1920)
(def screen-h 1080)
(def swath-colors
[[249 228 85]
[246 181 65]
[255 159 64]
[229 98 44]
[157 62 34]
[125 47 34]
[90 42 32]])
(defn setup []
(background 0)
(smooth)
(no-stroke)
(no-loop)
(no-fill)
)
(defn- draw-side [idx]
(doseq [i (map inc (reverse (range 10)))]
(stroke-weight (* i idx 2))
(apply stroke (map #(/ % i) (swath-colors (dec idx))))
(curve -1400 1000 -1900 0 60 0 -500 1000)
(line 60 0 1900 0)
)
)
(defn- draw-pentagon [idx]
(doseq [_ (range 5)]
(push-matrix)
(translate 0 (* idx -60))
(draw-side idx)
(pop-matrix)
(rotate (radians (/ 360 5)))
)
)
(defn draw []
(translate 400 600)
(doseq [pentagon-idx (map inc (range (count swath-colors)))]
(rotate (radians -10))
(draw-pentagon pentagon-idx)
)
(save "saved-inspiration.png")
)
(defsketch main
:title "inspiration from saved 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