Created
September 25, 2013 07:32
-
-
Save daveliepmann/6696262 to your computer and use it in GitHub Desktop.
Returning the serve: https://gist.github.com/jackrusher/6664422
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
(defn setup [] | |
(frame-rate 4) | |
(no-fill) | |
(stroke 0 0 0 128) | |
(smooth)) | |
(def rotor (atom 0)) | |
(def zoomer (atom 200)) | |
(def zoomer-flag (atom 1)) | |
(defn draw [] | |
(frame-rate 30) | |
(background 245) | |
(stroke-weight 3.5) | |
(stroke 29 0 16 35) | |
(translate 300 300) | |
(if (>= @zoomer 400) | |
(reset! zoomer-flag 2)) | |
(if (<= @zoomer -400) | |
(reset! zoomer-flag 1)) | |
(if (= 1 @zoomer-flag) | |
(do (swap! zoomer inc) | |
(swap! rotor inc)) | |
(do (swap! zoomer dec) | |
(swap! rotor dec))) | |
(rotate (radians @rotor)) | |
(doseq [i (range 0 360 1.5)] | |
(push-matrix) | |
(rotate (radians i)) | |
(translate 0 @zoomer) | |
(rotate (radians i)) | |
(scale (map-range (sin (radians (* i 6))) -1 1 0.35 1) | |
(map-range (sin (radians (* i 3))) -1 1 0.7 1)) | |
(ellipse 0 0 120 80) | |
(pop-matrix) | |
) | |
) | |
(defsketch toro-toro-torus | |
:title "plusfun with toroids" | |
:setup setup | |
:draw draw | |
:size [600 600]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment