Skip to content

Instantly share code, notes, and snippets.

@quephird
Created March 20, 2014 17:52
Show Gist options
  • Select an option

  • Save quephird/9669818 to your computer and use it in GitHub Desktop.

Select an option

Save quephird/9669818 to your computer and use it in GitHub Desktop.
Another little challenge to myself to see if I could replicate someone else's Processing sketch without looking: http://www.openprocessing.org/sketch/140475
(ns fun-with-quil.mushroom-clouds
(:use quil.core))
(def screen-w 800)
(def screen-h 800)
(def phase (atom 0))
(defn setup []
(smooth)
(ellipse-mode :center)
(no-stroke))
(defn draw []
(background 0)
(let [mushroom-count 20
ellipse-colors [[224 200 110]
[200 127 0]
[200 0 0]
[127 0 0]
[83 119 122]]
dy (/ screen-h mushroom-count 5)]
(translate (/ screen-w 2) 0)
(doseq [i (range mushroom-count)]
(doseq [j (range (count ellipse-colors))]
(let [a (sin (radians (+ @phase (* 2 i (/ 360 mushroom-count)))))
h (+ 20 (* a (+ j 4)))
w (* h (+ j 2))
c (ellipse-colors j)]
(apply fill c)
(ellipse 0 0 w h)
(translate 0 dy)))))
(swap! phase + 5))
(sketch
:title "mushroom clouds"
:setup setup
:draw draw
:renderer :java2d
:size [screen-w screen-h])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment