Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cieloazul310/3614f144fb2cabd44395399bbda9bdfe to your computer and use it in GitHub Desktop.
Save cieloazul310/3614f144fb2cabd44395399bbda9bdfe to your computer and use it in GitHub Desktop.
;; Example: Replicator
(deftime time 1)
(defn sin-transition [s]
(sin (* (/ time s) PI))
)
(defn path/replicator
[xform n path]
(->> (reduce #(conj % (mat2d/* (last %) xform))
[(mat2d/ident)]
(range (dec n)))
(map #(path/transform % path))))
(def timedeg (deg
(* 8 (sin-transition 1))
))
:start-sketch
(background "#08101D")
(style (stroke "#CECCFF" 1)
(path/replicator
(mat2d/* (translate [6 -6])
(rotate timedeg)
(scale [0.95 0.95]))
60
(circle [0 0] 40))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment