-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
playing around with overlapping flow fields for wind again
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) |