diff --git a/README.md b/README.md index a7f327c..d3018f8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Learn more by reading the { // Strokes a shape. - ronin.surface.stroke(shape, thickness, color) + this.stroke = (shape, color, thickness = 2) => { // Strokes a shape. + ronin.surface.stroke(shape, color, thickness) return shape } diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js index d9584e8..4005665 100644 --- a/desktop/sources/scripts/surface.js +++ b/desktop/sources/scripts/surface.js @@ -25,7 +25,7 @@ function Surface (ronin) { // Shape - this.stroke = (shape, width, color, context = this.context) => { + this.stroke = (shape, color, width, context = this.context) => { context.beginPath() this.trace(shape, context) context.lineWidth = width diff --git a/examples/basics/recursive.lisp b/examples/basics/recursive.lisp index 8580107..c532230 100644 --- a/examples/basics/recursive.lisp +++ b/examples/basics/recursive.lisp @@ -10,7 +10,7 @@ (circle (mul 5 v) (mul 5 v) - (mul 5 v)) 1 "red") + (mul 5 v)) "red" 1) (rec (sub v 5))))) (rec 100) \ No newline at end of file diff --git a/examples/basics/shapes.lisp b/examples/basics/shapes.lisp index 698f995..65a80b9 100644 --- a/examples/basics/shapes.lisp +++ b/examples/basics/shapes.lisp @@ -9,14 +9,14 @@ ; draw circle (stroke - (circle center-w center-h rad) 2 "white") + (circle center-w center-h rad) "white" 2) ; draw rect (stroke (rect - (sub center-w rad) (sub center-h rad) center-h center-h) 2 "white") + (sub center-w rad) (sub center-h rad) center-h center-h) "white" 2) ; draw line (stroke (line (sub center-w rad) center-h (add center-w rad) center-h)) -(stroke (text 10 170 200 "HELL") 2 "pink") \ No newline at end of file +(stroke (text 10 170 200 "HELL") "pink" 2) \ No newline at end of file diff --git a/examples/demo/branch.lisp b/examples/demo/branch.lisp index 163ac2f..a5e2031 100644 --- a/examples/demo/branch.lisp +++ b/examples/demo/branch.lisp @@ -7,7 +7,7 @@ ( (scale 0.95) (stroke - (line 0 0 100 100) 2 "white") + (line 0 0 100 100) "white" 2) (move 100 100) (pushTransform) (rotate diff --git a/examples/demo/fog.lisp b/examples/demo/fog.lisp index d742e9a..cd22de1 100644 --- a/examples/demo/fog.lisp +++ b/examples/demo/fog.lisp @@ -11,7 +11,7 @@ )) ; (defn when-animate () ( - (stroke (line prev-pos:x prev-pos:y mouse-pos:x mouse-pos:y) 4 "#72dec2") + (stroke (line prev-pos:x prev-pos:y mouse-pos:x mouse-pos:y) "#72dec2" 4) (move frame-rect:c frame-rect:m) (rotate 0.002) (scale 0.998) diff --git a/examples/demo/spiral.lisp b/examples/demo/spiral.lisp index 7f083ef..e4de4c7 100644 --- a/examples/demo/spiral.lisp +++ b/examples/demo/spiral.lisp @@ -9,7 +9,7 @@ (def spiral-y (add frame-rect:m (mul (sin (div v 11)) (div v 2)))) (def spiral-r (div v 2)) ; draw - (stroke (circle spiral-x spiral-y spiral-r) 1 "rgba(114,222,194,0.1)") (rec (sub v 0.3))))) + (stroke (circle spiral-x spiral-y spiral-r) "rgba(114,222,194,0.1)" 1) (rec (sub v 0.3))))) ; (defn redraw () ( (clear) diff --git a/examples/demo/stars.lisp b/examples/demo/stars.lisp index b93e657..139fc38 100644 --- a/examples/demo/stars.lisp +++ b/examples/demo/stars.lisp @@ -29,7 +29,7 @@ ( (stroke (line cx cy (:x (circle-pos cx cy r a)) (:y (circle-pos cx cy r a)) - ) 2 "white"))) + ) "white" 2))) ; (defn draw-star (cx cy r c) diff --git a/examples/events/on-animate.lisp b/examples/events/on-animate.lisp index 5a177e7..41a12ba 100644 --- a/examples/events/on-animate.lisp +++ b/examples/events/on-animate.lisp @@ -34,11 +34,11 @@ (elevation (sub i 1)) (add x seg-width) - (elevation i)) 4 + (elevation i)) (gradient (line 50 0 frame-rect:w 0) - ("#ffb545" "#72dec2"))))) + ("#ffb545" "#72dec2")) 4 ))) ; (defn redraw () diff --git a/examples/events/on-mouse.lisp b/examples/events/on-mouse.lisp index 78ae06d..da5433f 100644 --- a/examples/events/on-mouse.lisp +++ b/examples/events/on-mouse.lisp @@ -4,15 +4,15 @@ ( (clear) ; vertical line - (stroke (line e:x 0 e:x e:y) 2 "#ff0000") + (stroke (line e:x 0 e:x e:y) "#ff0000") ; horizontal line (stroke - (line 0 e:y e:x e:y) 2 "#72dec2") + (line 0 e:y e:x e:y) "#72dec2") ; circle (stroke (circle e:x - e:y 30) 2 "#ffffff"))) + e:y 30) "#ffffff"))) ; (on "mouse-down" redraw) (on "mouse-up" redraw) diff --git a/examples/projects/drawing.lisp b/examples/projects/drawing.lisp index 7316877..39fccbf 100644 --- a/examples/projects/drawing.lisp +++ b/examples/projects/drawing.lisp @@ -17,7 +17,7 @@ ( (debug e:is-down) (stroke - (line prev-pos:x prev-pos:y e:x e:y) 2 "white") + (line prev-pos:x prev-pos:y e:x e:y) "white") (set prev-pos "x" e:x "y" e:y) (debug prev-pos) (debug e))))) @@ -29,7 +29,7 @@ (set prev-pos "x" e:x "y" e:y) (debug e:x) (stroke - (circle e:x e:y 10) 4 + (circle e:x e:y 10) (stroke-color e)))) ; (on "mouse-down" draw-circle) diff --git a/examples/projects/spire.lisp b/examples/projects/spire.lisp index 4bea501..2fdb030 100644 --- a/examples/projects/spire.lisp +++ b/examples/projects/spire.lisp @@ -9,7 +9,7 @@ (e) ( (stroke - (circle e:x e:y e:d) 1 + (circle e:x e:y e:d) (gradient gradient-line ("black" "#ffb545"))))) ;