Skip to content

Instantly share code, notes, and snippets.

@samaaron
Created June 6, 2012 22:56
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save samaaron/2885344 to your computer and use it in GitHub Desktop.
Dancer draft
(ns rotating-spheres
(:use [quil.core]))
(defn setup []
(background 20)
(smooth))
(defn rand-circle-coords []
(let [max-x (* 2 (width))
max-y (* 2 (height))
max-z 800]
[(random (- max-x) max-x) (random (- max-y) max-y) (random (- max-z) max-z)]))
(def circle-coords
(repeatedly 80 rand-circle-coords))
(defn draw []
(background 20)
(fill 20)
(stroke 200 200 100)
(sphere-detail 10)
(doseq [coords circle-coords]
(with-translation coords
(sphere 10)))
(let [radius 1000
ypos 100
xpos (* radius (cos (radians (frame-count))))
zpos (* radius (sin (radians (frame-count))))]
(camera xpos ypos zpos 0 0 0 0 -1 0)))
(defsketch circles
:title "spinning circles"
:setup setup
:draw draw
:size [500 300]
:renderer :opengl
:target :perm-frame)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment