Updated some examples

This commit is contained in:
Devine Lu Linvega 2019-07-18 11:10:23 +09:00
parent c71cd4a6de
commit c1594dd4cc
6 changed files with 70 additions and 56 deletions

View File

@ -22,7 +22,6 @@ function Lisp (input, lib) {
include: (input, context) => { include: (input, context) => {
if (!input[1].value || !fs.existsSync(input[1].value)) { console.warn('Source', input[1].value); return [] } if (!input[1].value || !fs.existsSync(input[1].value)) { console.warn('Source', input[1].value); return [] }
const file = fs.readFileSync(input[1].value, { encoding: 'utf-8' }) const file = fs.readFileSync(input[1].value, { encoding: 'utf-8' })
console.log(input, context)
return interpret(this.parse(file), context) return interpret(this.parse(file), context)
}, },
let: function (input, context) { let: function (input, context) {

View File

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

View File

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

View File

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

View File

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

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") (clear)
; ronin path
(stroke (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")) (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"))