idk
This commit is contained in:
parent
3c2c4c1a5c
commit
c145ae1e0b
|
@ -46,9 +46,9 @@
|
||||||
|
|
||||||
(defn draw-state []
|
(defn draw-state []
|
||||||
; Set circle color.
|
; Set circle color.
|
||||||
(q/background 255)
|
;(q/background 255)
|
||||||
(q/stroke 0)
|
(q/stroke 0)
|
||||||
(q/rect (/ (q/width) 2) (/ (q/height) 2) 50 50)
|
;(q/rect (/ (q/width) 2) (/ (q/height) 2) 50 50)
|
||||||
(parse-string)
|
(parse-string)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -11,27 +11,31 @@
|
||||||
; circle color and position.
|
; circle color and position.
|
||||||
{:color 0
|
{:color 0
|
||||||
:angle 0
|
:angle 0
|
||||||
:delta 30})
|
:pos 0})
|
||||||
|
|
||||||
(defn update-state [state]
|
(defn update-state [state]
|
||||||
; Update sketch state by changing circle color and position.
|
; Update sketch state by changing circle color and position.
|
||||||
{:color (mod (+ (:color state) 0.7) 255)
|
{:color (mod (+ (:color state) 0.7) 255)
|
||||||
:angle (+ (:angle state) 0.1)})
|
:angle (+ (:angle state) 0.1)
|
||||||
|
:pos (mod (+ (:pos state) 1) 140)})
|
||||||
|
|
||||||
(defn draw-state [state]
|
(defn draw-state [state]
|
||||||
; Clear the sketch by filling it with light-grey color.
|
; Clear the sketch by filling it with light-grey color.
|
||||||
(q/background 240)
|
(q/background 240)
|
||||||
; Set circle color.
|
; Set circle color.
|
||||||
(q/fill (:color state) 255 255)
|
(q/fill (:color state) 255 255)
|
||||||
; Calculate x and y coordinates of the circle.
|
|
||||||
(let [angle (:angle state)
|
|
||||||
x (* 140 (q/cos angle))
|
|
||||||
y (* 150 (q/sin angle))]
|
|
||||||
; Move origin point to the center of the sketch.
|
|
||||||
(q/with-translation [(/ (q/width) 2)
|
(q/with-translation [(/ (q/width) 2)
|
||||||
(/ (q/height) 2)]
|
(/ (q/height) 2)]
|
||||||
; Draw the circle.
|
(doseq [i (range 10 20 2)]
|
||||||
(q/ellipse x y 100 100)))) ; #'test.core/draw-state
|
(let [angle (:angle state)
|
||||||
|
pos (:pos state)
|
||||||
|
x (* (* i 17) (q/cos angle))
|
||||||
|
y (* (* i 12) (q/sin angle))
|
||||||
|
size 30]
|
||||||
|
(q/ellipse x y size size)
|
||||||
|
(q/ellipse pos x size size)
|
||||||
|
(q/ellipse y x size size)
|
||||||
|
)))) ; #'test.core/draw-state
|
||||||
|
|
||||||
|
|
||||||
(q/defsketch test
|
(q/defsketch test
|
||||||
|
|
Loading…
Reference in a new issue