(ns seni.sketch-1438
(:require #+clj [seni.render :as r]
#+cljs [seni.render :as r :include-macros true]
[seni.math :as m]
[seni.perlin :as p]
[seni.movement :as mv]
[seni.bezier :as b]))
(def width 600)
(def height 600)
(defn setup []
(r/smooth)
; (r/no-stroke)
(r/colour-mode :rgb)
(r/frame-rate 10)
;(r/no-loop)
(r/stroke 255 0 0)
(r/stroke-weight 0))
(defn vary
[x y scale]
(+ y (* scale (p/perlin x y y))))
(defn wash
[r g b a]
(let [variation 200
line-width 70
line-segments 5]
(r/fill-float r g b a)
(doseq [h (range -20 1020 20)]
(b/render-bezier line-segments line-width
0 (vary 0.10 h variation)
333 (vary 333.33 h variation)
666 (vary 666.66 h variation)
1000 (vary 1000.10 h variation))
(b/render-bezier line-segments line-width
(vary 0.10 h variation) 0
(vary 333.33 h variation) 333
(vary 666.66 h variation) 666
(vary 1000.10 h variation) 1000))))
(defn draw [state]
(r/push-matrix)
(r/scale (/ width 1000) (/ height 1000))
(r/background-float 255)
(wash 160 160 160 100)
(r/fill-float 200 50 50 150)
(let [h 800]
(b/render-bezier 20 50
100 h
333.33 (- h 100)
666.66 (+ h 100)
900 h))
(let [h 500]
(b/render-bezier-trailing 20 50
100 h
333.33 (- h 100)
666.66 (+ h 100)
900 h))
(let [h 200]
(b/render-bezier-bulging 20 50
100 h
333.33 (- h 100)
666.66 (+ h 100)
900 h))
(r/pop-matrix))
(r/defsketch sketch-1438
:title "bezier curves"
:size [width height]
:setup setup
:draw draw)