Closed ampersanda closed 6 years ago
Thanks. It looks nice! I'm going to add it later (next week). Could you also update it so that it automatically starts over when it reaches last line? Currently after it reaches the last line it stops changing. Or instead of starting over do some other way to make it infinite.
I am currently read this, sorry. I just add some maybe "infinite" thing
(ns my.core
(:require [quil.core :as q :include-macros true]
[quil.middleware :as m]))
(defn setup []
(q/background 0)
(q/frame-rate 300)
(q/color-mode :hsb)
{:x 0
:y 0
:scale 20
:once false})
(defn update-state [{:keys [x y scale once] :as state}]
{:x (if (>= x (q/width)) 0 (+ x scale))
:y (if (>= x (q/width)) (+ y scale) y)
:scale scale
:once once})
(defn draw-state [{:keys [x y scale once] :as state}]
(q/stroke (* 255 (rand)) (* 255 (rand)) (* 255 (rand)))
(if (true? once)
(do
(q/no-stroke)
(q/fill 0)
(q/rect 0 y (q/width) scale)))
(if (>= y (q/height))
(swap! (q/state-atom) assoc :y 0 :once (not once))
(if (> (rand) 0.5)
(q/line x y (+ x scale) (+ y scale))
(q/line x (+ y scale) (+ x scale) y))))
(q/defsketch my
:host "host"
:size [500 500]
:setup setup
:update update-state
:draw draw-state
:middleware [m/fun-mode])
Thank you @ampersanda for the sketch! I added your sketch and now it's available on quil.info: http://quil.info/?example=ten%20print
Thank you very much. I learn some of your code and that's amazing
http://quil.info/sketches/show/-KzO2S1X6sg1ce9WkPRE
It's not pretty good but maybe I can submit this