Removed shapes, fixes #69
This commit is contained in:
13
examples/basics/basics.lisp
Normal file
13
examples/basics/basics.lisp
Normal file
@@ -0,0 +1,13 @@
|
||||
; basics
|
||||
|
||||
; define a variable
|
||||
(def a 25)
|
||||
(echo a)
|
||||
|
||||
; define a function
|
||||
(defn add-two (a) (add 2 a))
|
||||
(echo (add-two 4))
|
||||
|
||||
; use a lambda
|
||||
(times 5
|
||||
(λ (a) (echo (concat "time:" a))))
|
16
examples/basics/recursive.lisp
Normal file
16
examples/basics/recursive.lisp
Normal file
@@ -0,0 +1,16 @@
|
||||
; recursive
|
||||
|
||||
(clear)
|
||||
(defn rec
|
||||
(v)
|
||||
(if
|
||||
(gt v 0)
|
||||
(
|
||||
(stroke
|
||||
(circle
|
||||
(mul 5 v)
|
||||
(mul 5 v)
|
||||
(mul 5 v)) 1 "red")
|
||||
(rec
|
||||
(sub v 5)))))
|
||||
(rec 100)
|
24
examples/basics/shapes.lisp
Normal file
24
examples/basics/shapes.lisp
Normal file
@@ -0,0 +1,24 @@
|
||||
; Shapes
|
||||
|
||||
(clear)
|
||||
|
||||
; variables
|
||||
(def center-w (div (of (frame) "w") 2))
|
||||
(def center-h (div (of (frame) "h") 2))
|
||||
(def rad (div (of (frame) "h") 4))
|
||||
|
||||
; draw circle
|
||||
(stroke
|
||||
(circle center-w center-h rad) 2 "white")
|
||||
|
||||
; draw rect
|
||||
(stroke
|
||||
(rect
|
||||
(sub center-w rad) (sub center-h rad) center-h center-h) 2 "white")
|
||||
|
||||
; draw line
|
||||
(stroke
|
||||
(line
|
||||
(pos (sub center-w rad) center-h)
|
||||
(pos (add center-w rad) center-h)))
|
||||
(stroke (text 10 170 200 "HELL") 2 "pink")
|
8
examples/basics/svg.lisp
Normal file
8
examples/basics/svg.lisp
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
(clear)
|
||||
; ronin path
|
||||
(stroke
|
||||
(svg "M60,60 L195,60 A45,45 0 0,1 240,105 A45,45 0 0,1 195,150 L60,150 M195,150 A45,45 0 0,1 240,195 L240,240 ") 2 "white")
|
||||
; outline
|
||||
(stroke
|
||||
(svg "M15,15 L15,15 L285,15 L285,285 L15,285 Z") 1 "#555")
|
Reference in New Issue
Block a user