Add aphorism eight
This commit is contained in:
parent
f2a2bffccf
commit
e8675442c4
2 changed files with 44 additions and 1 deletions
42
src/aphorisms/eight.clj
Normal file
42
src/aphorisms/eight.clj
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
(ns aphorisms.eight
|
||||
(:require [quil.core :as q]
|
||||
[quil.middleware :as qm]))
|
||||
|
||||
(def size 500)
|
||||
(def padding 20)
|
||||
|
||||
(defn setup []
|
||||
(q/frame-rate 60)
|
||||
(q/color-mode :hsb)
|
||||
(q/smooth 16)
|
||||
{})
|
||||
|
||||
(defn update-state [state]
|
||||
state)
|
||||
|
||||
(defn draw-line [y]
|
||||
(let [p (* 0.0001 (q/millis))
|
||||
n (- (q/noise (+ p (* 0.005 y))) 0.5)
|
||||
w (- (* size 0.5) padding)]
|
||||
(q/with-translation [(* size 0.5) y]
|
||||
(q/with-rotation [(* q/PI n 0.25)]
|
||||
(q/stroke (+ 200 (* n 50)) 40 (* (q/map-range n 0 1 0.5 1) 230))
|
||||
(q/line (- w) 0 w 0)))))
|
||||
|
||||
(defn draw-state [state]
|
||||
(q/background 40)
|
||||
(q/no-fill)
|
||||
(q/stroke-weight 1.5)
|
||||
(doseq [y (range padding (- (q/height) (* padding 0.75)) (* padding 0.25))]
|
||||
(draw-line y)))
|
||||
|
||||
(q/defsketch eight
|
||||
:title "Eight"
|
||||
:size [500 500]
|
||||
:settings #(q/pixel-density (q/display-density))
|
||||
:setup setup
|
||||
:update update-state
|
||||
:draw draw-state
|
||||
:renderer :p3d
|
||||
:features [:keep-on-top :no-bind-output]
|
||||
:middleware [qm/pause-on-error qm/fun-mode])
|
||||
Loading…
Add table
Add a link
Reference in a new issue