Skip to content

Commit

Permalink
Improved examples
Browse files Browse the repository at this point in the history
  • Loading branch information
neauoire committed Mar 26, 2020
1 parent 2bfbb96 commit ff51bd7
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 126 deletions.
10 changes: 0 additions & 10 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ Project Run ^R
Project Re-Indent ^Shift+I
Project Clean Escape

Example

(clear)
(stroke
(rect 30 30 100 100) "red" 2)
(export)

Helpers

Ronin helpers are keywords that facilitates adding coordinates from the canvas into your script. The currently supported helpers are $rect, $pos, $line, $circle & $arc. Holding right-click while using a $helper will run the script as the mouse is injecting coordinates into the script. Paste the following script, and trace a shape in the canvas:
Expand All @@ -56,15 +49,12 @@ Import/Export

To save an image in memory, open an image file with Ronin, or drag an image file on the window. You will then be able to import it by using the file image's name. If the image file is `preview.png`, you can import it as follow:

; import image at position
(import $path
(pos 100 100))

; import image at position, with size
(import "preview.jpg"
(rect 100 100 400 400))

; export
(export)

Library
Expand Down
33 changes: 21 additions & 12 deletions examples/basics/gradients.lisp
Original file line number Diff line number Diff line change
@@ -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)
49 changes: 35 additions & 14 deletions examples/basics/shapes.lisp
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 8 additions & 2 deletions examples/basics/spiral.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
; animated recusive spiral
; by @local_guru

(def frame
(get-frame))

;
(defn rec
(v)
(if
Expand Down Expand Up @@ -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)
6 changes: 5 additions & 1 deletion examples/projects/spire.lisp → examples/basics/spire.lisp
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
; 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)
(
(stroke
(circle e:x e:y e:d)
(gradient gradient-line
("black" "#ffb545")))))
("black" "#72dec2")))))

;
(on "mouse-move" draw-circle)
12 changes: 11 additions & 1 deletion examples/basics/theme.lisp
Original file line number Diff line number Diff line change
@@ -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)
(
Expand All @@ -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)
3 changes: 3 additions & 0 deletions examples/basics/transform.branch.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(clear)

(defn branch
(v)
(if
Expand All @@ -20,5 +21,7 @@
(branch
(sub v 1))
(transform:pop))))

(branch 10)

(transform:reset)
12 changes: 12 additions & 0 deletions examples/basics/transforms.lisp
Original file line number Diff line number Diff line change
@@ -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)
File renamed without changes.
24 changes: 0 additions & 24 deletions examples/projects/folder.lisp

This file was deleted.

Loading

0 comments on commit ff51bd7

Please sign in to comment.