Merge branch 'master' of github.com:hundredrabbits/Ronin

This commit is contained in:
Quentin Leonetti
2019-07-18 10:59:32 +02:00
20 changed files with 574 additions and 394 deletions

9
examples/basics.lisp Normal file
View File

@@ -0,0 +1,9 @@
; basics
(
; define a variable
(def a 25)
(echo a)
; define a function
(defn add-two (a) (add 2 a))
(echo (add-two 4)))

View File

@@ -17,7 +17,7 @@
; Draw photo
(draw
(import
"../static/crystal.jpg"
(rect 0 0 400 400))

View File

@@ -1,36 +1,57 @@
; guides file
((clear)
(stroke (frame) 1 "red")
; guides
(
(clear)
(stroke
(frame) 1 "red")
(stroke
(line
(pos 0 0)
(pos (of (frame) "w") (of (frame) "h")))
1 "red")
(pos
(of
(frame) "w")
(of
(frame) "h"))) 1 "red")
(stroke
(line
(pos (of (frame) "w") 0)
(pos 0 (of (frame) "h")))
1 "red")
(pos
(of
(frame) "w") 0)
(pos 0
(of
(frame) "h"))) 1 "red")
(stroke
(line
(pos (div (of (frame) "w") 2) 0)
(pos (div (of (frame) "w") 2) (of (frame) "h")))
1 "red")
(pos
(div
(of
(frame) "w") 2) 0)
(pos
(div
(of
(frame) "w") 2)
(of
(frame) "h"))) 1 "red")
(stroke
(line
(pos 0 (div (of (frame) "h") 2))
(pos (div (of (frame) "w") 2) (of (frame) "h")))
1 "#72dec2")
(pos 0
(div
(of
(frame) "h") 2))
(pos
(div
(of
(frame) "w") 2)
(of
(frame) "h"))) 1 "#72dec2")
(stroke
(line
(pos (div (of (frame) "w") 2) 0)
(pos (of (frame) "w") (div (of (frame) "h") 2)))
1 "#72dec2")
)
(pos
(div
(of
(frame) "w") 2) 0)
(pos
(of
(frame) "w")
(div
(of
(frame) "h") 2))) 1 "#72dec2"))

4
examples/include.lisp Normal file
View File

@@ -0,0 +1,4 @@
; include
(
(include "../examples/recursive.lisp")
(echo line-color))

View File

@@ -1,12 +1,7 @@
; pixels
(
(clear)
(draw
"../../PREVIEW.jpg"
(frame))
(clear)
(import "../../PREVIEW.jpg"
(frame))
(pixels
(rect 0 0 500 500)
saturation
0.5)
)
(rect 0 0 500 500) saturation 0.5))

View File

@@ -1,21 +1,17 @@
; random
(
(clear)
(defn place
(rec)
(if (gt rec 0)
(clear)
(defn place
(rec)
(if
(gt rec 0)
(
(draw "../static/crystal.jpg"
(import "../static/crystal.jpg"
(rect
(random 200)
(random 200)
(random 200)
(random 200)))
(place (sub rec 1))
))
)
(place 30)
)
(random 200)
(random 200)))
(place
(sub rec 1)))))
(place 30))

View File

@@ -1,17 +1,16 @@
; recursive
(
(clear)
(def line-color "red")
(clear)
(defn rec
(v)
(if (gt v 0)
((stroke (circle
(mul 5 v)
(mul 5 v)
(mul 5 v)) 1 line-color)
(rec (sub v 5))))
)
(rec 100)
)
(v)
(if
(gt v 0)
(
(stroke
(circle
(mul 5 v)
(mul 5 v)
(mul 5 v)) 1 "red")
(rec
(sub v 5)))))
(rec 100))

View File

@@ -1,7 +1,5 @@
; resize
(
(clear)
(open "../../PREVIEW.jpg")
(resize 0.5 0.5)
)
(clear)
(open "../../PREVIEW.jpg")
(resize 0.5 0.5))

View File

@@ -1,4 +0,0 @@
(
(include "../examples/recursive.lisp")
(echo line-color)
)

View File

@@ -1,5 +1,8 @@
((fill
(svg "M255,60 L255,60 L135,180 L75,60 L195,210 L120,225 L105,225 L165,255 L225,195 L255,135 L285,150") "white")
(stroke
(svg "M405,15 L405,15 L150,150 L195,90 L240,135 L120,195 L75,90 L135,165 L120,225 L90,240 L60,210 L90,150 L255,180 L285,180 L285,165 ") "pink"))
(
(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"))

View File

@@ -1,30 +1,38 @@
((clear)
(def col
(lambda
(i)
(of
((theme "f_high")
(theme "f_med")
(theme "f_low")
(theme "f_inv")
(theme "b_high")
(theme "b_med")
(theme "b_low")
(theme "b_inv"))
(mod i 8))))
(def rec
(lambda
(v i)
(if (gt v 0)
((fill
(circle
(add
(div (of (frame) "w") 1.6)
(mul 1.5 v))
(mul 10 v)
(mul v (div v 5)))
(col i))
(rec
(sub v 3)
(add i 1))))))
(rec 40 0))
; theme
(
(clear)
(def col
(lambda
(i)
(of
(
(theme "f_high")
(theme "f_med")
(theme "f_low")
(theme "f_inv")
(theme "b_high")
(theme "b_med")
(theme "b_low")
(theme "b_inv"))
(mod i 8))))
(def rec
(lambda
(v i)
(if
(gt v 0)
(
(fill
(circle
(add
(div
(of
(frame) "w") 1.6)
(mul 1.5 v))
(mul 10 v)
(mul v
(div v 5)))
(col i))
(rec
(sub v 3)
(add i 1))))))
(rec 40 0))