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
;; Loaded from "https://gist.githubusercontent.com/cieloazul310/af30d75f11f5772461e1a7b267a2a98a/raw/eb1e9b7b1fe5ca203f122766e106411ab57c2b3a/sketch_sep-10-2020_16-36-07.glisp" | |
(defvar size 200) | |
(def r (- (/ size 2) 4)) | |
(def center [(/ size 2) (/ size 2)]) | |
(defvar r2 40) | |
(defvar length 24) | |
(def step (/ 1 length)) | |
(deftime time 0) |
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
(defvar size 200) | |
(def r (- (/ size 2) 4)) | |
(def center [(/ size 2) (/ size 2)]) | |
(defvar r2 40) | |
(defvar length 24) | |
(def step (/ 1 length)) | |
(def A (circle center r)) | |
(def B (circle center (- r r2))) |
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
(def field 200) | |
(defvar width 40) | |
(def height (/ width 2)) | |
(def sq (* (* (sqrt 2) height) 2)) | |
(defn row [x i] | |
(rect [x 0 | |
(if (even? i) width height) | |
(if (even? i) height width) | |
]) |
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
(def size 200) | |
(def half (/ size 2)) | |
(def center [half half]) | |
(defn k [i] (pow (/ (sqrt 2) 2) i )) | |
(defn kr [i] (* half (k i))) | |
(defn krect [i] | |
(rect | |
[ | |
(- half (kr i)) | |
(- half (kr i)) |
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
(def size 600) | |
(def half (/ size 2)) | |
(def center [half half]) | |
(def cyan "#00FFFF") | |
(def magenta "#FF00FF") | |
(def yellow "#FFFF00") | |
(def black "#000000") | |
(defn color [i] | |
(case (mod i 4) |
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
(def w 20) | |
(def h (/ w 2)) | |
(def items 4) | |
(def size (* w items)) | |
(def r (/ w (sqrt 3))) | |
(def cyan "#00FFFF") | |
(def magenta "#FF00FF") | |
(def yellow "#FFFF00") | |
(def black "#000000") | |
(defn color [i] |
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
(def w 20) | |
(def items 2) | |
(def size (* w items)) | |
(def r (/ w (sqrt 3))) | |
(defn hoge [x y i] (transform | |
(mat2d/* | |
(translate [ | |
(if (even? (floor (/ i (+ items 1)))) x (+ x (/ w 2))) | |
y |
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
;; Example: Replicator | |
(deftime time 0.5) | |
(defn sin-transition [t] | |
(sin (* (/ time t) PI)) | |
) | |
(def timedeg (deg | |
(* 40 (sin-transition 1)) | |
)) |
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
;; 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)] |
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
(defvar size 200) | |
(deftime time 1) | |
(defn transition [from to] | |
(/ (max 0 (- (min time to) from)) (- to from)) | |
) | |
(defn transitionVec [p q from to] | |
(vec2/+ p (vec2/* (vec2/- q p) [(transition from to) (transition from to)])) | |
) |
NewerOlder