Skip to content

Instantly share code, notes, and snippets.

@indy
Created April 14, 2012 09:20
Show Gist options
  • Save indy/2383086 to your computer and use it in GitHub Desktop.
Save indy/2383086 to your computer and use it in GitHub Desktop.
a1215
(ns work.a1215-cljs-orbit
(:use [art.canvas :only (filled-rect filled-circle)]
[art.util :only (canvas-2d-animation)]))
(defn draw
[ctx]
(let [time (* (. (js/Date.) (getTime)) 0.002)
x (+ 128 (* 96 (. js/Math sin time)))
y (+ 128 (* 96 (. js/Math cos (* 0.9 time))))]
(-> ctx
(filled-rect 0 0 255 255 "rgb(245,245,245)")
(filled-circle x y 10 "rgb(255,0,0)"))))
(defn ^:export main []
(canvas-2d-animation draw))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment