Skip to content

Commit

Permalink
make start position a function
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Nov 18, 2023
1 parent a91ca39 commit c225ea4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/shimmers/sketches/velocity_fields.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
(defn rv [x y]
(gv/vec2 (* width x) (* height y)))

(defn make-path [bounds seed scale buzzy pareto-width lifespan]
(defn make-path [bounds start-fn seed scale buzzy pareto-width lifespan]
(fn []
(let [start (rv (dr/random -0.1 1.1)
(dr/random -0.1 1.1))
(let [start (start-fn)
path
(->> [start (gv/vec2)]
(iterate
Expand Down Expand Up @@ -109,8 +108,10 @@
(dr/weighted {1.0 10
0.66 2
0.5 1})
1.0)]
(->> (make-path bounds seed scale buzzy pareto-width lifespan)
1.0)
start-fn (fn [] (rv (dr/random -0.1 1.1)
(dr/random -0.1 1.1)))]
(->> (make-path bounds start-fn seed scale buzzy pareto-width lifespan)
repeatedly
(keep identity)
(take (max 100 (int (* n (/ (g/area bounds) (* width height)))))))))
Expand All @@ -127,7 +128,7 @@
[true false] 2
[false true] 4
[true true] 8})]
{:seed (tm/abs (dr/randvec2 100))
{:seed (tm/abs (dr/randvec2 1000))
:scaling scaling
:scale (/ 1.0 scaling)
:offset (dr/weighted {0 2 4 2 8 2 12 1})
Expand Down

0 comments on commit c225ea4

Please sign in to comment.