diff --git a/README.md b/README.md index 93dfd41..09c527c 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Missing documentation. ### | Overlay Missing documentation. -- Parameters: `Position` `Rect` +- Parameters: `Position` `Rect` `Color` - Variables: ### % Render @@ -70,8 +70,8 @@ Missing documentation. ### + Vector Missing documentation. -- Parameters: `Any` `Position` -- Variables: +- Parameters: `Any` +- Variables: `fill_color` `stroke_width` `stroke_color` `line_cap` ### ? Help Missing documentation. @@ -115,5 +115,18 @@ rate=10 ; variable: rate = 10 ## Templates ### Watermark ``` -# 1280x720 ; / ../assets/photo.jpg 1280x 0,0 ; / ../assets/logo.png 60x60 20,620 +# 1280x720 ; / ../assets/photo.jpg 1280x 0,0 ; / ../assets/logo.png 60x60 20,640 +``` +## vectors +### Ronin Logo +``` ++ M150,53 A-96,97 0 0,0 246,150 M150,246 A97,-96 0 0,0 53,150 M53,101 A-48,-48 0 0,0 101,53 M246,101 A48,-48 0 0,1 198,53 M53,198 A-48,48 0 0,1 101,246 M246,198 A48,48 0 0,0 198,246 stroke_width=45 line_cap=square stroke_color=black +``` +### A Circle +``` ++ M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0 +``` +### Many Circles +``` ++ M 64, 64 m -50, 0 a 50,50 0 1,0 100,0 a 50,50 0 1,0 -100,0;+ M 64, 64 m -45, 0 a 45,45 0 1,0 90,0 a 45,45 0 1,0 -90,0;+ M 64, 64 m -40, 0 a 40,40 0 1,0 80,0 a 40,40 0 1,0 -80,0;+ M 64, 64 m -35, 0 a 35,35 0 1,0 70,0 a 35,35 0 1,0 -70,0;+ M 64, 64 m -30, 0 a 30,30 0 1,0 60,0 a 30,30 0 1,0 -60,0;+ M 64, 64 m -25, 0 a 25,25 0 1,0 50,0 a 25,25 0 1,0 -50,0;+ M 64, 64 m -20, 0 a 20,20 0 1,0 40,0 a 20,20 0 1,0 -40,0;+ M 64, 64 m -15, 0 a 15,15 0 1,0 30,0 a 15,15 0 1,0 -30,0;+ M 64, 64 m -10, 0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0;+ M 64, 64 m -5, 0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0 ``` \ No newline at end of file diff --git a/sources/media/graphics/logo.svg b/sources/media/graphics/logo.svg index 299703f..30e4113 100644 --- a/sources/media/graphics/logo.svg +++ b/sources/media/graphics/logo.svg @@ -1,8 +1,3 @@ - - - - - - + \ No newline at end of file diff --git a/sources/scripts/core/init.js b/sources/scripts/core/init.js index a664d1f..faf58a3 100644 --- a/sources/scripts/core/init.js +++ b/sources/scripts/core/init.js @@ -35,7 +35,8 @@ starting_canvas.height = parseInt(starting_canvas.height/40) * 40; commander.query("~ "+ronin.timestamp()); commander.query("# "+starting_canvas.render()); -commander.query("# layer=background"); +commander.query("# layer=Background"); commander.query("# #ff0000"); -commander.query("# layer=main"); -commander.query("> 1 ; > 0,0 ; > 1,1 ; > #ffffff"); \ No newline at end of file +commander.query("# layer=Main"); +commander.query("> 1 ; > 0,0 ; > 1,1 ; > #ffffff"); +commander.query("~ Ready."); \ No newline at end of file diff --git a/sources/scripts/modules/help.js b/sources/scripts/modules/help.js index f6ce3a3..e8af8fc 100644 --- a/sources/scripts/modules/help.js +++ b/sources/scripts/modules/help.js @@ -64,6 +64,13 @@ function Help(rune) html += "## Templates\n"; html += "### Watermark\n"; html += "```\n# 1280x720 ; / ../assets/photo.jpg 1280x 0,0 ; / ../assets/logo.png 60x60 20,640\n```\n"; + html += "## vectors\n"; + html += "### Ronin Logo\n"; + html += "```\n+ M150,53 A-96,97 0 0,0 246,150 M150,246 A97,-96 0 0,0 53,150 M53,101 A-48,-48 0 0,0 101,53 M246,101 A48,-48 0 0,1 198,53 M53,198 A-48,48 0 0,1 101,246 M246,198 A48,48 0 0,0 198,246 stroke_width=45 line_cap=square stroke_color=black\n```\n"; + html += "### A Circle\n"; + html += "```\n+ M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0\n```\n"; + html += "### Many Circles\n"; + html += "```\n+ M 64, 64 m -50, 0 a 50,50 0 1,0 100,0 a 50,50 0 1,0 -100,0;+ M 64, 64 m -45, 0 a 45,45 0 1,0 90,0 a 45,45 0 1,0 -90,0;+ M 64, 64 m -40, 0 a 40,40 0 1,0 80,0 a 40,40 0 1,0 -80,0;+ M 64, 64 m -35, 0 a 35,35 0 1,0 70,0 a 35,35 0 1,0 -70,0;+ M 64, 64 m -30, 0 a 30,30 0 1,0 60,0 a 30,30 0 1,0 -60,0;+ M 64, 64 m -25, 0 a 25,25 0 1,0 50,0 a 25,25 0 1,0 -50,0;+ M 64, 64 m -20, 0 a 20,20 0 1,0 40,0 a 20,20 0 1,0 -40,0;+ M 64, 64 m -15, 0 a 15,15 0 1,0 30,0 a 15,15 0 1,0 -30,0;+ M 64, 64 m -10, 0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0;+ M 64, 64 m -5, 0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0\n```\n"; return html; } diff --git a/sources/scripts/modules/overlay.js b/sources/scripts/modules/overlay.js index 086ef7e..81d36c1 100644 --- a/sources/scripts/modules/overlay.js +++ b/sources/scripts/modules/overlay.js @@ -4,7 +4,7 @@ function Overlay(rune) this.parameters = [Position,Rect,Color]; - this.color = new Color("#ff00ff"); + this.color = new Color("#ffffff"); this.layer = null; this.install = function() diff --git a/sources/scripts/modules/stroke.js b/sources/scripts/modules/stroke.js index d83a090..a7df8b8 100644 --- a/sources/scripts/modules/stroke.js +++ b/sources/scripts/modules/stroke.js @@ -20,12 +20,13 @@ function Stroke(rune) this.save_stroke = function(mode) { - s = "_ module="+mode+" "; - for (i = 0; i < this.positions.length; i++) { - s += this.positions[i].render()+" "; - } - if(this.positions.length > 0){ ronin.history.add(s); } - this.positions = null; + // TODO + // s = "_ module="+mode+" "; + // for (i = 0; i < this.positions.length; i++) { + // s += this.positions[i].render()+" "; + // } + // if(this.positions.length > 0){ ronin.history.add(s); } + // this.positions = null; } // Module diff --git a/sources/scripts/modules/vector.js b/sources/scripts/modules/vector.js index 3fa5cba..0fe0936 100644 --- a/sources/scripts/modules/vector.js +++ b/sources/scripts/modules/vector.js @@ -2,33 +2,36 @@ function Vector(rune) { Module.call(this,rune); - this.parameters = [Any,Position]; + this.parameters = [Any]; + this.variables = {"fill_color" : "none","stroke_width" : 2,"stroke_color" : "#ffffff", "line_cap" : "square"}; + + this.layer = null; + + this.install = function() + { + this.layer = new Layer("Preview",this); + this.layer.element.setAttribute("style","z-index:8000"); + ronin.surface.add_layer(this.layer); + } // Module this.passive = function(cmd) { - ronin.overlay.clear(); - ronin.overlay.context().lineCap="round"; - ronin.overlay.context().lineWidth = ronin.brush.size; - ronin.overlay.context().strokeStyle = "red"; - ronin.overlay.context().stroke(new Path2D(cmd.content.join(" "))); + console.log(cmd.variable("stroke_width")); + this.layer.clear(); + this.layer.context().lineCap = cmd.variable("line_cap") ? cmd.variable("line_cap").value : "round"; + this.layer.context().lineWidth = cmd.variable("stroke_width") ? cmd.variable("stroke_width").value : ronin.brush.size; + this.layer.context().strokeStyle = cmd.variable("stroke_color") ? cmd.variable("stroke_color").value : "#ffffff"; + this.layer.context().stroke(new Path2D(cmd.content.join(" "))); } this.active = function(cmd) { - ronin.overlay.clear(); - ronin.surface.context().lineCap="round"; - ronin.surface.context().lineWidth = ronin.brush.size; - ronin.surface.context().strokeStyle = ronin.brush.color.rgba(); - ronin.surface.context().stroke(new Path2D(cmd.content.join(" "))); + this.layer.clear(); + ronin.surface.active_layer.context().lineCap = cmd.variable("line_cap") ? cmd.variable("line_cap").value : "round"; + ronin.surface.active_layer.context().lineWidth = cmd.variable("stroke_width") ? cmd.variable("stroke_width").value : ronin.brush.size; + ronin.surface.active_layer.context().strokeStyle = cmd.variable("stroke_color") ? cmd.variable("stroke_color").value : "#ffffff"; + ronin.surface.active_layer.context().stroke(new Path2D(cmd.content.join(" "))); } - - // + M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0 ; Draw a circle - // M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z - - // Large 128 - // @ 128x128;> 2 #ffffff;+ M 64, 64 m -50, 0 a 50,50 0 1,0 100,0 a 50,50 0 1,0 -100,0;+ M 64, 64 m -45, 0 a 45,45 0 1,0 90,0 a 45,45 0 1,0 -90,0;+ M 64, 64 m -40, 0 a 40,40 0 1,0 80,0 a 40,40 0 1,0 -80,0;+ M 64, 64 m -35, 0 a 35,35 0 1,0 70,0 a 35,35 0 1,0 -70,0;+ M 64, 64 m -30, 0 a 30,30 0 1,0 60,0 a 30,30 0 1,0 -60,0;+ M 64, 64 m -25, 0 a 25,25 0 1,0 50,0 a 25,25 0 1,0 -50,0;+ M 64, 64 m -20, 0 a 20,20 0 1,0 40,0 a 20,20 0 1,0 -40,0;+ M 64, 64 m -15, 0 a 15,15 0 1,0 30,0 a 15,15 0 1,0 -30,0;+ M 64, 64 m -10, 0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0;+ M 64, 64 m -5, 0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0;$ logo - // Icon 128 - // @ 128x128;> 4 #ffffff;+ M 64, 64 m -50, 0 a 50,50 0 1,0 100,0 a 50,50 0 1,0 -100,0;+ M 64, 64 m -40, 0 a 40,40 0 1,0 80,0 a 40,40 0 1,0 -80,0;+ M 64, 64 m -30, 0 a 30,30 0 1,0 60,0 a 30,30 0 1,0 -60,0;+ M 64, 64 m -20, 0 a 20,20 0 1,0 40,0 a 20,20 0 1,0 -40,0;+ M 64, 64 m -10, 0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0;$ logo } \ No newline at end of file