Skip to content

Commit

Permalink
Plot forward a tenth of a second instead of redrawing background
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Sep 16, 2023
1 parent 912d798 commit 0f4e8e8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/shimmers/sketches/kinetic_elliptics.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,19 @@
(assoc state :t (/ (q/millis) 1000.0)))

(defn draw [{:keys [origin root t]}]
(q/background 1.0 0.25)
(q/background 1.0 1.0)
(q/no-stroke)
(q/fill 0.0 1.0)
(cq/circle origin 2.0)
(doseq [[parent element color] (plot-elements origin root t)]
(q/no-stroke)
(cq/circle element 2.0)
(q/stroke-weight 2.0)
(apply q/stroke color)
(q/line parent element)))
(doseq [group (apply map vector
(map (partial plot-elements origin root)
(map + (range 0.0 0.1 (/ 0.1 4)) (repeat t))))]
(doseq [[parent element color] group]
(q/no-stroke)
(cq/circle element 2.0)
(q/stroke-weight 2.0)
(apply q/stroke color)
(q/line parent element))))

(defn page []
[sketch/with-explanation
Expand Down

0 comments on commit 0f4e8e8

Please sign in to comment.