diff --git a/src/aphorisms/twenty_seven.clj b/src/aphorisms/twenty_seven.clj new file mode 100644 index 0000000..fdbcd29 --- /dev/null +++ b/src/aphorisms/twenty_seven.clj @@ -0,0 +1,49 @@ +(ns aphorisms.twenty-seven + (:require [quil.core :as q] + [quil.middleware :as qm] + [thi.ng.geom.rect :as r] + [thi.ng.geom.core :as g])) + +(def bounds (r/rect 640 480)) + +(defn setup [] + (q/frame-rate 30) + (q/ellipse-mode :center) + (q/color-mode :hsb 100) + {}) + +(defn update-state [_] + _) + +(def x-noise-scale 0.006) +(def y-noise-scale 0.005) + +(def margin 40) + +(defn draw-state [_] + (q/background 255) + ;; create margin using separate graphics + (let [g (q/create-graphics (- (q/width) margin) (- (q/height) margin))] + (q/with-graphics g + (q/stroke 20) + + (doseq [i (range 20 101 10) + :let [noise-x (* i i x-noise-scale)]] + (q/ellipse (* (q/width) 0.33) + (* (q/height) 0.33) + i + i))) + (q/image g (* 0.5 margin) (* 0.5 margin)))) + +; define 2 images and a mask to apply to them + + +#_:clj-kondo/ignore +(q/defsketch twenty-seven + :title "Twenty-Seven" + :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]) diff --git a/src/aphorisms/twenty_six.clj b/src/aphorisms/twenty_six.clj new file mode 100644 index 0000000..eec324e --- /dev/null +++ b/src/aphorisms/twenty_six.clj @@ -0,0 +1,52 @@ +(ns aphorisms.twenty-six + (:require [quil.core :as q] + [quil.middleware :as qm] + [thi.ng.geom.rect :as r] + [thi.ng.geom.core :as g])) + +(def bounds (r/rect 1500 500)) + +(defn setup [] + (q/frame-rate 30) + (q/ellipse-mode :center) + (q/color-mode :hsb 100) + {}) + +(defn update-state [_] + _) + +(defn divisors [n] + (->> + (range 1 (inc (int (/ n 2)))) + (filter #(zero? (rem n %))))) + +(divisors 800) +;; => (1 2 4 5 8 10 16 20 25 32 40 50 80 100 160 200 400) +(divisors 230) +;; => (1 2 5 10 23 46 115) + +(def x-noise-scale 0.006) +(def y-noise-scale 0.005) + +(defn draw-state [_] + (q/background 100) + (q/stroke-weight 1) + (doseq [y (range 0 (inc (- (g/height bounds) 10)) 10) + x (range 0 (inc (- (g/width bounds) 10)) 10) + :let [noise-x (* x x-noise-scale) + noise-y (* y y-noise-scale)]] + (q/with-translation [(+ x 5) (+ y 5)] + (q/with-rotation [(* q/TWO-PI (q/noise noise-x noise-y))] + (q/stroke (q/map-range (* noise-x noise-y) -1 1 90 70) 60 80) + (q/line [-3 0] [3 0])))) + #_(q/save-frame "exports/twenty-six--business-card.png")) + +#_:clj-kondo/ignore +(q/defsketch twenty-six + :title "Twenty-Six" + :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])