-3

I am a Clojure newbie, I want to draw a line and circle on the screen, and it should be anti-aliasing, how to do it? if someone can paste some sample codes to me?

Another problem, I define a Map:

(def {:a 1, :b 2, :c 3}, i try to change it to be {:a 1, :b 99, :c 3},

how to do it?

David Kroukamp
  • 34,930
  • 13
  • 72
  • 130
user1653363
  • 355
  • 1
  • 5
  • 7

1 Answers1

1

Take a look at Quil. https://github.com/quil/quil

It is based on Processing http://processing.org and is easy to get working.

I think this does what you want...adapted from the example:

(ns foo
  (:use quil.core))

(defn setup []
  (smooth)                          ;;Turn on anti-aliasing
  (frame-rate 10)                    ;;Set framerate to 10 FPS
  (background 200))                 ;;Set the background colour to
                                    ;;  a nice shade of grey.
(defn draw []
  (stroke 0)              ;;Set the stroke colour to a black
  (stroke-weight 3)       ;;Set the stroke thickness to 3
  (line 10 10 50 50)
  (line 20 20 100 50))

(defsketch example                  ;;Define a new sketch named example
  :title "foo"  ;;Set the title of the sketch
  :setup setup                      ;;Specify the setup fn
  :draw draw                        ;;Specify the draw fn
  :size [323 200])
Roger Allen
  • 2,144
  • 14
  • 29