Skip to content

Instantly share code, notes, and snippets.

@t-sin
Created May 28, 2019 13:54
Show Gist options
  • Select an option

  • Save t-sin/01eaf541487a224e984715ac5016a4d4 to your computer and use it in GitHub Desktop.

Select an option

Save t-sin/01eaf541487a224e984715ac5016a4d4 to your computer and use it in GitHub Desktop.
(ns genart-quil.core
(:require [quil.core :as q]
[quil.middleware :as m]))
(defn setup []
(q/frame-rate 30)
(q/color-mode :hsb)
;; x軸が0から500の間で、なにか変化する値のシーケンスを生成
(for [x (range 0 500)] (q/sin (* x 0.04))))
(defn update-state [state]
;; 値の更新はなにもしない
state)
(defn draw-state [state]
(q/background 0)
(q/fill 0 0 0 0) ;; 塗り潰しなし
(q/stroke-weight 1) ;; 線幅1
(q/stroke 120 255 255 30) ;; 薄い線
(doseq [x (range 0 500)]
(let [r (* 80 (nth state x))]
(q/ellipse x 250 r r))))
(q/defsketch genart-quil
:title "You spin my circle right round"
:size [500 500]
:setup setup
:update update-state
:draw draw-state
:features [:keep-on-top]
:middleware [m/fun-mode])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment