Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns creative-playground.sketches.eye
- (:require [quil.core :as q]
- [quil.middleware :as m]))
- ; define colors below
- ; diffrent diameter offsets down there
- (def diam-offset [{:x 1 :y 1}
- {:x 2 :y 2}
- {:x 3 :y 2}
- {:x 3 :y 4}
- {:x 5 :y 4}])
- (defn setup []
- (q/frame-rate 30)
- (q/smooth)
- (q/background 180)
- {:diam 0
- :direction 1})
- (defn update-state [state]
- (let [diam (+ (:diam state) (* (:direction state)))]
- (cond
- (> diam 500) {:direction -1
- :diam diam}
- (< diam 0) {:direction 1
- :diam diam}
- :else {:direction (:direction state)
- :diam diam})))
- (defn draw-state [state]
- (q/background 44 62 80)
- (q/stroke 44 62 80)
- (q/stroke-weight 5)
- (q/fill 127 140 141)
- (let [cent-x (/ (q/width) 2)
- cent-y (/ (q/height) 2)
- diam (:diam state)]
- (doseq [pos diam-offset]
- (q/ellipse cent-x cent-y (/ diam (:x pos)) (/ diam (:y pos))))))
- (q/defsketch eye
- :title "Eyes"
- :size [500 500]
- :setup setup
- :draw draw-state
- :update update-state
- :features [:keep-on-top]
- :middleware [m/fun-mode])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement