Four: Mndsgn.
This commit is contained in:
parent
430a31d126
commit
c62e13c3d1
2 changed files with 63 additions and 1 deletions
|
|
@ -4,5 +4,7 @@
|
||||||
: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.9.0"]
|
:dependencies [[org.clojure/clojure "1.9.0"]
|
||||||
[quil "2.7.1"]]
|
[quil "2.8.0"]
|
||||||
|
[thi.ng/geom "1.0.0-RC3" :exclusions [org.jogamp.jogl/jogl-all
|
||||||
|
org.jogamp.gluegen/gluegen-rt]]]
|
||||||
:main aphorisms.core)
|
:main aphorisms.core)
|
||||||
|
|
|
||||||
60
src/aphorisms/four.clj
Normal file
60
src/aphorisms/four.clj
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
(ns aphorisms.four
|
||||||
|
(:require [thi.ng.geom.vector :as v]
|
||||||
|
[thi.ng.math.core :as m]
|
||||||
|
[quil.core :as q]
|
||||||
|
[quil.middleware :as qm]))
|
||||||
|
|
||||||
|
(def padding 20)
|
||||||
|
(def width 500)
|
||||||
|
(def height 300)
|
||||||
|
|
||||||
|
(defn setup []
|
||||||
|
(q/frame-rate 60)
|
||||||
|
(q/color-mode :hsb 255 100 100)
|
||||||
|
(q/smooth 8)
|
||||||
|
{})
|
||||||
|
|
||||||
|
(defn update-state [state]
|
||||||
|
state)
|
||||||
|
|
||||||
|
(def segments 50)
|
||||||
|
(def line-dist 10)
|
||||||
|
(def step-size 0.004)
|
||||||
|
|
||||||
|
(defn draw-state [state]
|
||||||
|
(q/background 31 11 100)
|
||||||
|
(q/no-fill)
|
||||||
|
(q/stroke 316 12 95)
|
||||||
|
;; wavy wayves
|
||||||
|
(dotimes [i 6]
|
||||||
|
(q/begin-shape)
|
||||||
|
(doseq [seg (range 51)]
|
||||||
|
(let [range (- width padding padding)
|
||||||
|
x (* seg (/ range segments))
|
||||||
|
y (/ height 3)
|
||||||
|
step (+ (q/map-range x 0 range 0 q/TWO-PI)
|
||||||
|
(* (q/millis) step-size)
|
||||||
|
(* i q/PI 1/8))]
|
||||||
|
(q/vertex (+ padding x) (+ (+ y (* line-dist (Math/sin step)))
|
||||||
|
(* i line-dist)))))
|
||||||
|
(q/end-shape))
|
||||||
|
;; cubes
|
||||||
|
(dotimes [i 3]
|
||||||
|
(let [x 30
|
||||||
|
y 30
|
||||||
|
op (if (even? (quot (q/millis) 1000)) + -)]
|
||||||
|
(when (<= i (quot (mod (q/millis) 1000) 75))
|
||||||
|
(q/rect (+ x (* i 3))
|
||||||
|
(op y (* i 6))
|
||||||
|
30 30)))))
|
||||||
|
|
||||||
|
|
||||||
|
(q/defsketch four
|
||||||
|
:title "mndsgn."
|
||||||
|
:size [width height]
|
||||||
|
:settings #(q/pixel-density (q/display-density))
|
||||||
|
:setup setup
|
||||||
|
:update update-state
|
||||||
|
:draw draw-state
|
||||||
|
: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