Created
January 8, 2014 22:21
-
-
Save quephird/8325531 to your computer and use it in GitHub Desktop.
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 space-dots | |
| (:use quil.core)) | |
| (def screen-w 1000) | |
| (def screen-h 1000) | |
| (def phase (atom 0)) | |
| (defn- setup [] | |
| (smooth) | |
| (ellipse-mode :center) | |
| ) | |
| (defn- draw [] | |
| (background 0) | |
| (translate (/ screen-w 2) (/ screen-h 2)) | |
| (doseq [i (range 15)] | |
| (let [t (* i (/ 180 15)) | |
| r (* 400 (Math/cos (+ (radians (* 3 t)) @phase))) | |
| x (* r (Math/cos (radians t))) | |
| y (* r (Math/sin (radians t))) | |
| cs [[255 0 0] | |
| [255 127 0] | |
| [255 255 0] | |
| [127 255 0] | |
| [0 255 0] | |
| [0 255 127] | |
| [0 255 255] | |
| [0 127 255] | |
| [0 0 255] | |
| [127 0 255] | |
| [255 0 255] | |
| [255 0 127] | |
| [255 127 127] | |
| [127 127 127] | |
| [127 127 0] | |
| ]] | |
| (apply fill (cs i)) | |
| (ellipse x y 10 10) | |
| ) | |
| ) | |
| (swap! phase + (radians 5)) | |
| (save-frame "space-dots##.png") | |
| ) | |
| (sketch | |
| :title "space-dots" | |
| :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