can't do 3d

This commit is contained in:
Anish Lakhwara 2023-01-03 18:47:47 +10:00
parent 26dade3b0f
commit a0f8179cfe
2 changed files with 7 additions and 4 deletions

View file

@ -4,4 +4,5 @@
:license {:name "Eclipse Public License" :license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"} :url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.10.1"] :dependencies [[org.clojure/clojure "1.10.1"]
[quil "4.0.0-SNAPSHOT"]]) [quil "3.1.0"]])
;[quil "4.0.0-SNAPSHOT"]])

View file

@ -23,6 +23,7 @@
:angle (+ (:angle state) 0.1)}) :angle (+ (:angle state) 0.1)})
(def w 50) (def w 50)
(def h 200)
(def offset (atom 0)) (def offset (atom 0))
(defn draw-state [state] (defn draw-state [state]
@ -35,14 +36,15 @@
(let [angle (:angle state) (let [angle (:angle state)
sin (q/sin (+ angle @offset)) sin (q/sin (+ angle @offset))
cos (q/cos angle) cos (q/cos angle)
h (q/map-range sin -1 1 10 w)] h (q/map-range sin -1 1 20 h)]
(q/rect (- (/ (q/width) 2) i) 0 (- w 2) h) (q/rect (- (/ w 2) (- (/ (q/width) 2) i)) 0 (- w 2) h)
(swap! offset + 0.5))))) (swap! offset + 1.5)))))
(q/defsketch cubes (q/defsketch cubes
:title "You spin my circle right round" :title "You spin my circle right round"
:size [500 500] :size [500 500]
; setup function called only once, during sketch initialization. ; setup function called only once, during sketch initialization.
; :renderer :opengl
:setup setup :setup setup
:settings settings :settings settings
; update-state is called on each iteration before draw-state. ; update-state is called on each iteration before draw-state.