Skip to content

Instantly share code, notes, and snippets.

@daveliepmann
Last active February 23, 2018 14:02
Show Gist options
  • Save daveliepmann/ca44bf8c11255cd76c82ed086cee9b23 to your computer and use it in GitHub Desktop.
Save daveliepmann/ca44bf8c11255cd76c82ed086cee9b23 to your computer and use it in GitHub Desktop.
;; # A whirlwind tour of Maria.cloud
;; ### 🔺 🔷 🔴 🔶 🔵 🔻
;; The first thing you should do is draw something:
(circle 50)
;; we provide an extensive picture language:
(layer
(colorize "springgreen" (circle 50))
(position 100 50 (colorize "pink" (circle 50))))
;; ## 🚧 Safety Measures 🚫
;; We installed safety nets under the trapezes, so learners can practice flips with confidence:
(circle 20 10)
(range)
color-names
(filter #(clojure.string/includes? (first %) "blue")
color-names)
;; ### Power tools 🛠️
;; We give learner some special functions and macros to make onboarding easier:
(what-is ["💩" "🤠"])
(doc circle)
(source circle)
;; ## 🎨 🖼️ more sophisticated drawings
;; variable opacity
(map #(opacity % (colorize "blue" (triangle 40)))
(range 0 1 0.1))
;; colorization functions
(map #(colorize % (square 50))
(map #(hsl % 100 50) (range 0 250 25)))
;; Halloween pumpkin
(layer
(position 40 60 (colorize "orange" (circle 40)))
(position 10 30 (colorize "black" (triangle 24)))
(position 45 30 (colorize "black" (triangle 24)))
(position 20 75 (colorize "black" (rectangle 40 10)))
(position 25 74 (colorize "orange" (rectangle 10 5)))
(position 45 74 (colorize "orange" (rectangle 10 5)))
(position 33 82 (colorize "orange" (rectangle 10 5)))
(position 35 2 (colorize "black" (rectangle 10 20))))
;; color gradient
(apply above
(map #(colorize (hsl (rescale % 0 1000 120 220) 90 90)
(rectangle 500 5))
(range 0 1000 5)))
;; cartwheel rainbow rectangles
(layer
(fill "white" (rectangle 750 70))
(apply beside
(map #(->> (rectangle 30 50)
(rotate %)
(opacity 0.5)
(fill (hsl % 90 45)))
(range 0 360 15))))
;; confetti
(let [palette (cycle ["aqua" "springgreen" "magenta"])]
(->> (repeat 20 (triangle 20))
(map #(position (rand-int 500) (rand-int 500) %))
(map colorize palette)
(cons (colorize "#eeeeee" (rectangle 550 550)))
(apply layer)))
;; flower (from first-day ClojureBridge learner!)
(defn flower []
(let [leaves ["hotpink" "blue" "red" "darkturquoise" "mediumvioletred"]]
(layer
(position 300 60 (colorize (rand-nth leaves) (circle 60)))
(position 150 200 (colorize (rand-nth leaves) (circle 60)))
(position 450 200 (colorize (rand-nth leaves) (circle 60)))
(position 300 350 (colorize (rand-nth leaves) (circle 60)))
(position 200 100 (colorize (rand-nth leaves) (circle 60)))
(position 400 100 (colorize (rand-nth leaves) (circle 60)))
(position 200 300 (colorize (rand-nth leaves) (circle 60)))
(position 400 300 (colorize (rand-nth leaves) (circle 60)))
(position 290 410 (colorize "forestgreen" (rectangle 25 270)))
(position 215 500 (colorize "forestgreen" (circle 80)))
(position 390 500 (colorize "forestgreen" (circle 80)))
(position 300 200 (colorize "yellow" (circle 115))))))
(cell (interval 250 flower))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment