Twenty-eight till thirty-one
This commit is contained in:
parent
21b86ce217
commit
d88a17f54e
6 changed files with 231 additions and 3 deletions
49
src/aphorisms/thirty_one.clj
Normal file
49
src/aphorisms/thirty_one.clj
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
(ns aphorisms.thirty-one
|
||||
(: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 setup []
|
||||
(q/frame-rate 30)
|
||||
(q/ellipse-mode :center)
|
||||
(q/rect-mode :corners)
|
||||
(q/color-mode :hsb 255)
|
||||
{})
|
||||
|
||||
(def circ
|
||||
(c/circle 100))
|
||||
|
||||
(defn draw-state [_]
|
||||
(let [t (* 0.0002 (q/millis))]
|
||||
(q/background 232)
|
||||
(q/fill 255)
|
||||
(q/no-stroke)
|
||||
(q/blend-mode :difference)
|
||||
(q/with-translation [(/ (g/width bounds) 2)
|
||||
(/ (g/height bounds) 2)]
|
||||
(q/ellipse 0 0 (g/width circ) (g/height circ))
|
||||
|
||||
(doseq [i (range 12)
|
||||
:let [offset (* 0.82 (g/height circ))]]
|
||||
(q/ellipse (* offset (Math/cos (- i t))) (* offset (Math/sin (- i t))) (* 0.41 (g/width circ)) (* 0.41 (g/height circ))))
|
||||
|
||||
(doseq [i (mapv (fn [i] (/ i m/TWO_PI )) (range 1 41))
|
||||
:let [offset (* 1.23 (g/height circ))
|
||||
circumference (* m/TWO_PI offset)]]
|
||||
(q/ellipse (* offset (Math/cos (+ t i))) (* offset (Math/sin (+ t i))) (/ circumference 80) (/ circumference 80))))))
|
||||
|
||||
#_:clj-kondo/ignore
|
||||
(q/defsketch thirty-one
|
||||
:title "Thirty-One"
|
||||
:size (:size bounds)
|
||||
:settings #(q/pixel-density (q/display-density))
|
||||
: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