Created
June 6, 2012 22:56
-
-
Save samaaron/2885344 to your computer and use it in GitHub Desktop.
Dancer draft
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 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