Skip to content

Instantly share code, notes, and snippets.

@quephird
Created January 8, 2014 22:21
Show Gist options
  • Select an option

  • Save quephird/8325531 to your computer and use it in GitHub Desktop.

Select an option

Save quephird/8325531 to your computer and use it in GitHub Desktop.
(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