Skip to content

Instantly share code, notes, and snippets.

@quephird
Created January 22, 2013 22:35
Show Gist options
  • Save quephird/4599317 to your computer and use it in GitHub Desktop.
Save quephird/4599317 to your computer and use it in GitHub Desktop.
An attempt at reproducing a drawing on deviantART here: http://stebev.deviantart.com/art/Balls-of-fire-Pong-332-349019003
(ns balls-of-fire-inspiration
(:use quil.core quil.applet))
(def screen-w 1920)
(def screen-h 1080)
(defn- star [c l w]
(let [graphics (current-applet)
lobe-count 8
control-point-length (* l 0.8)]
(push-matrix)
(apply fill c)
(doseq [_ (range lobe-count)]
(rotate (radians (/ 360 lobe-count)))
(begin-shape)
(vertex 0 0)
(.bezierVertex graphics 0 0
(- w) control-point-length
0 l)
(.bezierVertex graphics w control-point-length
0 0
0 0)
(end-shape)
)
(pop-matrix)
)
)
(defn- blurred-star []
(push-matrix)
(translate (* screen-w 0.5) (* screen-h 0.67))
(star [27 1 2] 1200 500)
(display-filter :blur 10)
(doseq [[c l w] [[[90 13 7 100] 1000 200]
[[194 56 9 100] 900 125]
[[255 92 17 100] 800 75]
[[255 180 36 100] 700 50]
[[255 255 0] 600 25]]]
(star c l w))
(display-filter :blur 4)
(pop-matrix)
)
(defn- big-black-circles []
(push-matrix)
(let [d 200]
(translate -120 0)
(fill 0)
(doseq [x (range (inc (int (/ screen-w d 1.2))))
y (range (inc (int (/ screen-h d 1.2))))]
(ellipse (* x d 1.2) (* y d 1.2) d d)
)
)
(pop-matrix)
)
(defn setup []
(background 0)
(smooth)
(no-stroke)
(no-loop)
)
(defn draw []
(blurred-star)
(big-black-circles)
)
(defsketch main
:title "balls of fire inspiration"
:setup setup
:draw draw
:size [screen-w screen-h]
:renderer :p2d
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment