Skip to content

Commit

Permalink
playing around with overlapping flow fields for wind again
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Jan 18, 2025
1 parent 2b980fc commit e420065
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/shimmers/sketches.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
shimmers.sketches.barcodes
shimmers.sketches.beat-table
shimmers.sketches.blobical
shimmers.sketches.blustery-day
shimmers.sketches.bold-moves
shimmers.sketches.box-o-rama
shimmers.sketches.braid
Expand Down
50 changes: 50 additions & 0 deletions src/shimmers/sketches/blustery_day.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
(ns shimmers.sketches.blustery-day
(:require
[shimmers.common.svg :as csvg :include-macros true]
[shimmers.common.ui.controls :as ctrl]
[shimmers.common.ui.svg :as usvg]
[shimmers.math.deterministic-random :as dr]
[shimmers.math.equations :as eq]
[shimmers.math.vector :as v]
[shimmers.sketch :as sketch :include-macros true]
[thi.ng.geom.circle :as gc]
[thi.ng.geom.core :as g]
[thi.ng.geom.vector :as gv]
[thi.ng.math.core :as tm]))

(def width 800)
(def height 600)
(defn rv [x y]
(gv/vec2 (* width x) (* height y)))

(defn shapes [seed bounds]
(for [cell (g/subdivide bounds {:cols (/ width 5)
:rows (/ height 5)})
:let [p (g/centroid cell)
[x y] p
dir-noise (dr/noise-at-point-01 seed 0.0025 p)
amp-noise (dr/noise-at-point-01 seed 0.0025 (tm/+ p (:size bounds)))
size-noise (dr/noise-at-point-01 seed 0.0025 (tm/+ p (tm/* (:size bounds) 2)))
jitter-noise (dr/noise-at-point-01 seed 0.0025 (tm/+ p (tm/* (:size bounds) 3)))]
:when (< (dr/gaussian 0.0 (tm/smoothstep* 0.5 1.0 jitter-noise)) 1.0)]
(gc/circle (-> p
(v/+polar (* 32.0 amp-noise) (* 1.5 eq/TAU dir-noise))
(v/+polar (* 0.75 (dr/gaussian 0.0 (tm/smoothstep* 0.5 1.0 jitter-noise)))
(dr/random-tau)))
(+ 0.5 (* 2.0 size-noise)))))

(defn scene [{:keys [scene-id]}]
(csvg/svg-timed {:id scene-id
:width width
:height height
:stroke "black"
:fill "white"
:stroke-width 0.5}
(shapes (dr/noise-seed)
(g/scale-size (csvg/screen width height) 0.925))))

(sketch/definition blustery-day
{:created-at "2025-01-18"
:tags #{:genuary2025}
:type :svg}
(ctrl/mount (usvg/page sketch-args scene)))

0 comments on commit e420065

Please sign in to comment.