From c1594dd4cc4c07985ff509d90e0d12d1f3f7f8bd Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 18 Jul 2019 11:10:23 +0900 Subject: [PATCH] Updated some examples --- desktop/sources/scripts/lisp.js | 1 - examples/glitch.lisp | 2 +- examples/guides.lisp | 71 +++++++++++++++++++++------------ examples/pixels.lisp | 13 ++---- examples/random.lisp | 26 +++++------- examples/svg.lisp | 13 +++--- 6 files changed, 70 insertions(+), 56 deletions(-) diff --git a/desktop/sources/scripts/lisp.js b/desktop/sources/scripts/lisp.js index ed2a26a..3a38a83 100644 --- a/desktop/sources/scripts/lisp.js +++ b/desktop/sources/scripts/lisp.js @@ -22,7 +22,6 @@ function Lisp (input, lib) { include: (input, context) => { 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' }) - console.log(input, context) return interpret(this.parse(file), context) }, let: function (input, context) { diff --git a/examples/glitch.lisp b/examples/glitch.lisp index f84b501..b5f723e 100644 --- a/examples/glitch.lisp +++ b/examples/glitch.lisp @@ -17,7 +17,7 @@ ; Draw photo - (draw + (import "../static/crystal.jpg" (rect 0 0 400 400)) diff --git a/examples/guides.lisp b/examples/guides.lisp index c6bff1a..f956c75 100644 --- a/examples/guides.lisp +++ b/examples/guides.lisp @@ -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") -) \ No newline at end of file + (pos + (div + (of + (frame) "w") 2) 0) + (pos + (of + (frame) "w") + (div + (of + (frame) "h") 2))) 1 "#72dec2")) \ No newline at end of file diff --git a/examples/pixels.lisp b/examples/pixels.lisp index d45baa9..d4edbff 100644 --- a/examples/pixels.lisp +++ b/examples/pixels.lisp @@ -1,12 +1,7 @@ ; pixels - ( - (clear) - (draw - "../../PREVIEW.jpg" - (frame)) + (clear) + (import "../../PREVIEW.jpg" + (frame)) (pixels - (rect 0 0 500 500) - saturation - 0.5) -) \ No newline at end of file + (rect 0 0 500 500) saturation 0.5)) \ No newline at end of file diff --git a/examples/random.lisp b/examples/random.lisp index 0753a05..ff3754c 100644 --- a/examples/random.lisp +++ b/examples/random.lisp @@ -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) -) \ No newline at end of file + (random 200) + (random 200))) + (place + (sub rec 1))))) + (place 30)) \ No newline at end of file diff --git a/examples/svg.lisp b/examples/svg.lisp index 2a81943..497871b 100644 --- a/examples/svg.lisp +++ b/examples/svg.lisp @@ -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")) \ No newline at end of file +( + (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")) \ No newline at end of file