Improved vector paths.

This commit is contained in:
Devine Lu Linvega 2016-11-16 10:50:52 -08:00
parent 2ae737c5b5
commit d9673d2121
3 changed files with 18 additions and 2 deletions

View File

@ -41,6 +41,12 @@ $ ! ; Clear temporary storage
| ! ; Remove all guides | ! ; Remove all guides
``` ```
##Vector(SVG Path)
```
+ M10 10 h 80 v 80 h -80 Z ; Draw a square outline
+ M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80 ; Draw a bezier
```
##Stroke* ##Stroke*
``` ```
- 0,0 0,10 10,10 10,0 0,0 ; Draw a square - 0,0 0,10 10,10 10,0 0,0 ; Draw a square

View File

@ -3,6 +3,7 @@ function Commander(element,element_input)
this.element = element; this.element = element;
this.element_input = element_input; this.element_input = element_input;
this.cmd = null; this.cmd = null;
this.storage = [];
this.show = function() this.show = function()
{ {
@ -57,7 +58,7 @@ function Commander(element,element_input)
ronin.vector.active(cmd); ronin.vector.active(cmd);
break; break;
} }
this.storage.push(content);
this.hide(); this.hide();
} }

View File

@ -10,7 +10,13 @@ function Vector()
this.active = function(cmd) this.active = function(cmd)
{ {
var path = new Path2D('M 100,100 h 50 v 50 h 50'); var path = new Path2D(cmd.content.join(" "));
console.log(ronin.size);
ronin.canvas.context().lineCap="round";
ronin.canvas.context().lineWidth = ronin.brush.size;
ronin.canvas.context().strokeStyle = ronin.brush.color.rgba();
ronin.canvas.context().stroke(path); ronin.canvas.context().stroke(path);
} }
@ -18,4 +24,7 @@ function Vector()
{ {
return "Vector: " return "Vector: "
} }
// Demo:
// > 5 #ff0000;+ M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80
} }