Improved examples
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
; gradients
|
||||
|
||||
(def frame
|
||||
(get-frame))
|
||||
|
||||
(clear)
|
||||
(def gl
|
||||
(line 0 0 frame:h frame:h))
|
||||
(def cl1
|
||||
(gradient gl
|
||||
(theme:b_med theme:b_high)))
|
||||
(def cl2
|
||||
(gradient gl
|
||||
(theme:b_high theme:b_med)))
|
||||
(guide gl)
|
||||
|
||||
(def colors
|
||||
("#72dec2" "#ffffff"))
|
||||
|
||||
(def gradient1
|
||||
(gradient
|
||||
(line 0 0 frame:h frame:h) colors))
|
||||
|
||||
(def gradient2
|
||||
(gradient
|
||||
(line frame:h frame:h 0 0) colors))
|
||||
|
||||
(fill
|
||||
(circle frame:m frame:m frame:m) cl1)
|
||||
(circle frame:m frame:m frame:m) gradient1)
|
||||
|
||||
(fill
|
||||
(circle frame:m frame:m
|
||||
(mul frame:m 0.75)) cl2)
|
||||
(mul frame:m 0.75)) gradient2)
|
||||
|
||||
(fill
|
||||
(circle frame:m frame:m
|
||||
(mul frame:m 0.5)) cl1)
|
||||
(mul frame:m 0.5)) gradient1)
|
||||
@@ -1,42 +1,63 @@
|
||||
; display a collection of all shapes.
|
||||
|
||||
(def colors
|
||||
("#000000" "#72dec2"))
|
||||
|
||||
;
|
||||
(clear)
|
||||
|
||||
(stroke
|
||||
(rect 0 0 300 300) theme:b_high)
|
||||
(rect 0 0 300 300) colors:0)
|
||||
|
||||
(stroke
|
||||
(circle 150 150 150) theme:b_med)
|
||||
(circle 150 150 150) colors:1)
|
||||
|
||||
(stroke
|
||||
(ellipse 150 150 75 150) theme:b_high)
|
||||
(ellipse 150 150 75 150) colors:0)
|
||||
|
||||
(stroke
|
||||
(line 0 150 300 150) theme:b_high)
|
||||
(line 0 150 300 150) colors:0)
|
||||
|
||||
(stroke
|
||||
(text 600 300 60 "hell") theme:b_med)
|
||||
(text 600 300 60 "hell") colors:1)
|
||||
|
||||
(stroke
|
||||
(arc 600 298 296
|
||||
(rad 180)
|
||||
(rad -90)) theme:b_med)
|
||||
(rad -90)) colors:1)
|
||||
|
||||
(stroke
|
||||
(poly
|
||||
(pos 300 300)
|
||||
(pos 600 0)
|
||||
(pos 600 300)) theme:b_high)
|
||||
(pos 600 300)) colors:0)
|
||||
|
||||
(transform:move 0 300)
|
||||
|
||||
(fill
|
||||
(rect 0 0 300 300) theme:b_high)
|
||||
(rect 0 0 300 300) colors:0)
|
||||
|
||||
(fill
|
||||
(circle 150 150 150) theme:b_med)
|
||||
(circle 150 150 150) colors:1)
|
||||
|
||||
(fill
|
||||
(ellipse 150 150 75 150) theme:b_high)
|
||||
(ellipse 150 150 75 150) colors:0)
|
||||
|
||||
(fill
|
||||
(line 0 150 300 150) theme:b_high)
|
||||
(line 0 150 300 150) colors:0)
|
||||
|
||||
(fill
|
||||
(text 600 300 60 "hell") theme:b_med)
|
||||
(text 600 300 60 "hell") colors:1)
|
||||
|
||||
(fill
|
||||
(arc 600 298 296
|
||||
(rad 180)
|
||||
(rad -90)) theme:b_med)
|
||||
(rad -90)) colors:1)
|
||||
|
||||
(fill
|
||||
(poly
|
||||
(pos 300 300)
|
||||
(pos 600 0)
|
||||
(pos 600 300)) theme:b_high)
|
||||
(pos 600 300)) colors:0)
|
||||
|
||||
(transform:reset)
|
||||
@@ -1,5 +1,9 @@
|
||||
; animated recusive spiral
|
||||
; by @local_guru
|
||||
|
||||
(def frame
|
||||
(get-frame))
|
||||
|
||||
;
|
||||
(defn rec
|
||||
(v)
|
||||
(if
|
||||
@@ -27,12 +31,14 @@
|
||||
(circle spiral-x spiral-y spiral-r)
|
||||
(color 114 222 194 0.1) 1)
|
||||
(rec
|
||||
(sub v 0.3)))))
|
||||
(sub v 0.3)))))
|
||||
|
||||
;
|
||||
(defn redraw
|
||||
()
|
||||
(
|
||||
(clear)
|
||||
(rec 300)))
|
||||
|
||||
;
|
||||
(on "animate" redraw)
|
||||
@@ -1,9 +1,12 @@
|
||||
; this demo shows how to use the mouse events to draw make a simple drawing tool.
|
||||
|
||||
;
|
||||
(clear)
|
||||
|
||||
;
|
||||
(def gradient-line
|
||||
(line frame:c 0 frame:c frame:h))
|
||||
|
||||
;
|
||||
(defn draw-circle
|
||||
(e)
|
||||
@@ -11,6 +14,7 @@
|
||||
(stroke
|
||||
(circle e:x e:y e:d)
|
||||
(gradient gradient-line
|
||||
("black" "#ffb545")))))
|
||||
("black" "#72dec2")))))
|
||||
|
||||
;
|
||||
(on "mouse-move" draw-circle)
|
||||
@@ -1,9 +1,18 @@
|
||||
; display color from the theme.
|
||||
|
||||
(def theme
|
||||
(get-theme))
|
||||
|
||||
|
||||
; ex: theme:f_high
|
||||
(clear)
|
||||
|
||||
(clear)
|
||||
|
||||
(fill frame theme:background)
|
||||
|
||||
(def color-box
|
||||
(div frame:h 10))
|
||||
|
||||
(defn print-value
|
||||
(item id)
|
||||
(
|
||||
@@ -22,5 +31,6 @@
|
||||
(keys theme) id)) theme:f_high)
|
||||
(fill
|
||||
(text 400 box-y 30 item) theme:f_high)))
|
||||
|
||||
(map
|
||||
(values theme) print-value)
|
||||
@@ -1,4 +1,5 @@
|
||||
(clear)
|
||||
|
||||
(defn branch
|
||||
(v)
|
||||
(if
|
||||
@@ -20,5 +21,7 @@
|
||||
(branch
|
||||
(sub v 1))
|
||||
(transform:pop))))
|
||||
|
||||
(branch 10)
|
||||
|
||||
(transform:reset)
|
||||
@@ -1,19 +1,31 @@
|
||||
; transforms
|
||||
|
||||
(clear)
|
||||
|
||||
(transform:move 150 150)
|
||||
|
||||
(fill
|
||||
(circle 0 0 150) theme:b_inv)
|
||||
|
||||
(transform:move 300 0)
|
||||
|
||||
(transform:rotate
|
||||
(rad 90))
|
||||
|
||||
(fill
|
||||
(circle 0 0 150) theme:b_high)
|
||||
|
||||
(transform:move 300 0)
|
||||
|
||||
(transform:rotate
|
||||
(rad 90))
|
||||
|
||||
(fill
|
||||
(circle 0 0 150) theme:b_med)
|
||||
|
||||
(transform:move 300 0)
|
||||
|
||||
(fill
|
||||
(circle 0 0 150) theme:b_low)
|
||||
|
||||
(transform:reset)
|
||||
@@ -1,24 +0,0 @@
|
||||
; open every file in a folder.
|
||||
(defn filter-jpg
|
||||
(file-name)
|
||||
(eq
|
||||
(last
|
||||
(split file-name ".")) "jpg"))
|
||||
;
|
||||
(def images
|
||||
(filter
|
||||
(dir) filter-jpg))
|
||||
;
|
||||
(debug
|
||||
(concat "Found: "
|
||||
(len images)))
|
||||
;
|
||||
(defn image-operation
|
||||
(file-name)
|
||||
(
|
||||
(def file-path
|
||||
(concat
|
||||
(dirpath) "/" file-name))
|
||||
(open file-path)))
|
||||
;
|
||||
(each images image-operation)
|
||||
Reference in New Issue
Block a user