Genart
Here's some generative art stuff I've been messing around with lately.
Circles
First e:q
ns circles.core
(:require [quil.core :as q]
(:as m]))
[quil.middleware
def TAU (* q/PI 2))
(
defn setup []
(10))
(q/frame-rate
defn outlineify [im color sz]
(let [eroded (q/create-graphics sz sz)
(
solid (q/create-graphics sz sz)
output (q/create-graphics sz sz)]
(q/with-graphics solidapply q/background color))
(
(q/with-graphics eroded0 0)
(q/image im :erode)
(q/display-filter :erode))
(q/display-filter
(q/with-graphics output0)
(q/background
(q/mask-image solid eroded)0 0))
(q/image solid
(q/mask-image output im)
output))
defn make-circ [bars scale]
(let [sz (int (* scale 500))
(
gr (q/create-graphics sz sz)]
(q/with-graphics gr255)
(q/fill
(q/no-stroke)* scale 250) (* scale 250)]
(q/with-translation [(doseq [t (range 0 bars)]
(let [t (q/random TAU)
(25.0 (* scale 200.0))
d (q/random * (+ 0.5 (/ d 200.0) scale))]
s (
(q/with-rotation [t]0 d (* 20 s) (* 10 s)))))))
(q/rect
gr))
defn draw []
(0 100) (q/random 0 100) (q/random 0 100))
(q/background (q/random doseq [i (range 20)]
(let [m (- 1. (/ i 20.))
(100 900)
cx (q/random 100 900)
cy (q/random -> (q/random-gaussian)
scale (* 0.3)
(+ 1.0)
(+ m)
(max 0.3)
(min 2.0))
(map (fn [_] (q/random 0 100)) (range 3))]
color (
(q/image
(outlineify+ 80 (* (q/random-gaussian) (+ 80 (* m 160)))) scale)
(make-circ (
colorint (* scale 500)))
(- cx (* scale 250))
(- cy (* scale 250))))))
(
defn start []
(
(q/defsketch circles:title "Circ"
:size [1000 1000]
:setup setup
:draw (fn [] nil)
:mouse-clicked (fn [] (draw))
:features [:keep-on-top]
:middlewake [m/fun-mode]))