Skip to content

Instantly share code, notes, and snippets.



Created Aug 10, 2014
What would you like to do?
p5.js in ClojureScript
<!doctype html>
<style>body { padding: 0; }</style>
<script src=''></script>
<script src='out/goog/base.js'></script>
<script src='myproject.js'></script>
(defproject publisher "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url ""
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-2280"]]
:plugins [[lein-cljsbuild "1.0.4-SNAPSHOT"]]
:source-paths ["src"]
:cljsbuild {
:builds [{:id "myproject"
:source-paths ["src"]
:compiler {
:output-to "myproject.js"
:output-dir "out"
:optimizations :none
:source-map true}}]})
; src/myproject/sketch.cljs
(ns myproject.sketch)
(defn setup []
(js/createCanvas 640 480))
(defn draw []
(js/fill (if js/mouseIsPressed 0 255))
(js/ellipse js/mouseX js/mouseY 80 80))
(doto js/window
(aset "setup" setup)
(aset "draw" draw))
; For live reloading in e.g. LightTable, evaluate the defn and the doto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.