heyarne.aphorisms/src/aphorisms/twenty_three.clj
2021-12-24 14:23:13 +01:00

40 lines
1.1 KiB
Clojure

(ns aphorisms.twenty-three
(:require [quil.core :as q]
[quil.middleware :as qm]
[thi.ng.geom.rect :as r]
[thi.ng.geom.core :as g]
[thi.ng.math.core :as m]))
;; I'm in bed. It is 9th of October, the temperatures are mild, the sund is
;; shining and my girlfriend is reading me texts about the physical appearance
;; of angels.
(def bounds (r/rect 500 500))
(defn setup []
(q/frame-rate 30)
(q/ellipse-mode :center)
(q/color-mode :hsb 360 100 100)
{:n 1})
(defn update-state [_]
{:n (inc (q/seconds))})
(defn draw-state [{n :n}]
(q/with-translation (g/centroid bounds)
(q/background 0 0 95)
(q/no-fill)
(dotimes [i n]
(q/with-rotation [(m/radians (* i 6))]
(q/stroke (mod (+ 170 (* i 3)) 360) 80 100 90)
(q/ellipse 0 (* i 2) 16 (+ (* i 10) 100))))))
#_:clj-kondo/ignore
(q/defsketch twenty-three
:title "Twenty-Three"
:size (:size bounds)
:settings #(q/pixel-density (q/display-density))
:setup setup
:update update-state
:draw draw-state
:middleware [qm/pause-on-error qm/fun-mode])