Add unstaged sketch no. thirty-two
This commit is contained in:
parent
37e152bc60
commit
5f6c31c09b
1 changed files with 97 additions and 0 deletions
97
src/aphorisms/thirty_two.clj
Normal file
97
src/aphorisms/thirty_two.clj
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
(ns aphorisms.thirty-two
|
||||||
|
(:require [quil.core :as q]
|
||||||
|
[quil.middleware :as qm]
|
||||||
|
[thi.ng.geom.rect :as r]
|
||||||
|
[thi.ng.geom.core :as g]
|
||||||
|
[thi.ng.geom.circle :as c]
|
||||||
|
[thi.ng.math.core :as m]))
|
||||||
|
|
||||||
|
(def bounds (r/rect 600 600))
|
||||||
|
(def canvas (g/scale bounds 0.92))
|
||||||
|
|
||||||
|
(defn update-state
|
||||||
|
([] {:t 0})
|
||||||
|
([_state] {:t (* 0.0002 (q/millis))}))
|
||||||
|
|
||||||
|
(defn setup []
|
||||||
|
(q/frame-rate 30)
|
||||||
|
(q/ellipse-mode :center)
|
||||||
|
(q/rect-mode :corners)
|
||||||
|
(q/color-mode :hsb 255)
|
||||||
|
(update-state))
|
||||||
|
|
||||||
|
(defn draw-state [{:keys [t]}]
|
||||||
|
(let [circles 10]
|
||||||
|
(q/background 232)
|
||||||
|
(q/no-fill)
|
||||||
|
(q/with-translation [(/ (g/width bounds) 2)
|
||||||
|
(/ (g/height bounds) 2)]
|
||||||
|
(q/stroke-weight 1)
|
||||||
|
(q/stroke 40 (* (* 0.5 (+ 1 (Math/sin (* 6 t)))) 255))
|
||||||
|
(q/ellipse 0 0 60 60)
|
||||||
|
|
||||||
|
(q/stroke 40)
|
||||||
|
(q/stroke-weight 1)
|
||||||
|
(doseq [i (range circles)
|
||||||
|
:let [off (* i (/ (* 2 Math/PI) circles))
|
||||||
|
radius 100
|
||||||
|
circ (* 2 Math/PI radius)]]
|
||||||
|
(q/ellipse (* radius (Math/cos (+ t off))) (* radius (Math/sin (+ t off)))
|
||||||
|
(/ circ circles 2) (/ circ circles 2)))
|
||||||
|
|
||||||
|
(q/stroke-weight 0.5)
|
||||||
|
(doseq [i (range (* 2 circles))
|
||||||
|
:let [n (* 2 circles)
|
||||||
|
radius 100
|
||||||
|
off (* i (/ (* 2 Math/PI) n))
|
||||||
|
circ (* 2 Math/PI radius)]]
|
||||||
|
(q/ellipse (* radius (Math/cos (+ t off))) (* radius (Math/sin (+ t off)))
|
||||||
|
(/ circ n 2) (/ circ n 2)))
|
||||||
|
|
||||||
|
(q/stroke-weight 2)
|
||||||
|
(doseq [i (range (* 3 circles))
|
||||||
|
:let [n (* 3 circles)
|
||||||
|
radius 140
|
||||||
|
off (* i (/ (* 2 Math/PI) n))]]
|
||||||
|
(q/ellipse (* radius (Math/sin (+ t off))) (* radius (Math/cos (+ t off))) 1 1))
|
||||||
|
|
||||||
|
(q/stroke-weight 2)
|
||||||
|
(doseq [i (range (* 3 circles))
|
||||||
|
:let [n (* 3 circles)
|
||||||
|
radius 144
|
||||||
|
off (* i (/ (* 2 Math/PI) n))]]
|
||||||
|
(q/ellipse (* radius (Math/cos (+ t off))) (* radius (Math/sin (+ t off))) 1 1))
|
||||||
|
|
||||||
|
(q/stroke-weight 2)
|
||||||
|
(doseq [i (range (* 3 circles))
|
||||||
|
:let [n (* 3 circles)
|
||||||
|
radius 148
|
||||||
|
off (* i (/ (* 2 Math/PI) n))]]
|
||||||
|
(q/ellipse (* radius (Math/sin (+ t off))) (* radius (Math/cos (+ t off))) 1 1))
|
||||||
|
|
||||||
|
(q/stroke-weight 2)
|
||||||
|
(doseq [i (range (* 3 circles))
|
||||||
|
:let [n (* 3 circles)
|
||||||
|
radius 152
|
||||||
|
off (* i (/ (* 2 Math/PI) n))]]
|
||||||
|
(q/ellipse (* radius (Math/cos (+ t off))) (* radius (Math/sin (+ t off))) 1 1))
|
||||||
|
|
||||||
|
(q/stroke-weight 0.1)
|
||||||
|
(doseq [i (range (* 3 circles))
|
||||||
|
:let [n (* 0.5 circles)
|
||||||
|
radius 202
|
||||||
|
off (* i (/ (* 2 Math/PI) n))
|
||||||
|
circ (* 2 Math/PI radius)]]
|
||||||
|
(q/ellipse (* radius (Math/sin (+ t off))) (* radius (Math/cos (+ t off)))
|
||||||
|
(/ circ n 6) (/ circ n 6))))))
|
||||||
|
|
||||||
|
#_:clj-kondo/ignore
|
||||||
|
(q/defsketch thirty-two
|
||||||
|
:title "Thirty-Two"
|
||||||
|
:size (:size bounds)
|
||||||
|
:settings #(q/pixel-density (q/display-density))
|
||||||
|
:features [:keep-on-top]
|
||||||
|
:setup setup
|
||||||
|
:update update-state
|
||||||
|
:draw draw-state
|
||||||
|
:middleware [qm/pause-on-error #_(screenshottable) qm/fun-mode])
|
||||||
Loading…
Add table
Add a link
Reference in a new issue