Building ports framework
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
<script type="text/javascript" src="scripts/layers/render.js"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/docs.js"></script>
|
||||
<script type="text/javascript" src="scripts/port.js"></script>
|
||||
<script type="text/javascript" src="scripts/io.js"></script>
|
||||
<script type="text/javascript" src="scripts/query.js"></script>
|
||||
<script type="text/javascript" src="scripts/keyboard.js"></script>
|
||||
@@ -27,7 +28,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
const {dialog,app} = require('electron').remote;
|
||||
const fs = require('fs');
|
||||
const app_path = app.getAppPath();
|
||||
|
||||
@@ -25,7 +25,7 @@ function Docs()
|
||||
this.print_intro = function()
|
||||
{
|
||||
html = "# Ronin\n";
|
||||
html += "Ronin is a simple open-source graphic design tool.\n";
|
||||
html += "Ronin is a simple open-source graphic design tool.\n\n";
|
||||
html += "<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW.jpg' width='600'/>\n";
|
||||
return html;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ function Docs()
|
||||
|
||||
for(method_name in methods){
|
||||
var method_val = methods[method_name];
|
||||
html += "- `"+method_name+"`, no details.\n";
|
||||
html += "- `"+method_name+":`, no details.\n";
|
||||
}
|
||||
return html;
|
||||
}
|
||||
@@ -71,8 +71,9 @@ function Docs()
|
||||
var html = "### Ports\n";
|
||||
|
||||
for(port_name in ports){
|
||||
var port_val = ports[setting_name];
|
||||
html += "- `"+port_name+"`, no details.\n";
|
||||
var port = ports[port_name];
|
||||
console.log(ports);
|
||||
html += "- `->"+port.name+"`{"+port.input+","+port.output+"}, **"+port.value+"/"+port.max+"** "+port.docs+".\n";
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
@@ -6,20 +6,17 @@ function Brush()
|
||||
|
||||
this.pointers = [
|
||||
new Pointer({offset:{x:0,y:0}}),
|
||||
// new Pointer({offset:{x:1,y:0}}),
|
||||
// new Pointer({offset:{x:-1,y:0}}),
|
||||
// new Pointer({offset:{x:0,y:1}}),
|
||||
// new Pointer({offset:{x:0,y:-1}}),
|
||||
new Pointer({offset:{x:2,y:2}}),
|
||||
new Pointer({offset:{x:4,y:4}}),
|
||||
];
|
||||
|
||||
this.ports.speed = 0;
|
||||
this.ports.distance = 0;
|
||||
this.ports.red = 0;
|
||||
this.ports.green = 0;
|
||||
this.ports.blue = 0;
|
||||
this.ports.alpha = 1;
|
||||
this.ports.x = 1;
|
||||
this.ports.noise = 0;
|
||||
this.ports = {};
|
||||
|
||||
this.ports.speed = new Port("speed",false,true,0,50,"The cursor speed");
|
||||
this.ports.distance = new Port("distance",false,true,0,null,"The cursor distance");
|
||||
this.ports.red = new Port("red",true,true,0,255,"The brush color value(red)");
|
||||
this.ports.green = new Port("green",true,true,0,255,"The brush color value(green)");
|
||||
this.ports.blue = new Port("blue",true,true,0,255,"The brush color value(blue)");
|
||||
|
||||
this.thickness = function(line)
|
||||
{
|
||||
@@ -39,6 +36,7 @@ function Brush()
|
||||
|
||||
this.red = function(line)
|
||||
{
|
||||
return 255;
|
||||
if(this.ports[this.routes.red]){
|
||||
return this.ports[this.routes.red] * 255;
|
||||
}
|
||||
@@ -47,6 +45,7 @@ function Brush()
|
||||
|
||||
this.green = function(line)
|
||||
{
|
||||
return 0;
|
||||
if(this.ports[this.routes.green]){
|
||||
return this.ports[this.routes.green] * 255;
|
||||
}
|
||||
@@ -55,6 +54,7 @@ function Brush()
|
||||
|
||||
this.blue = function(line)
|
||||
{
|
||||
return 0;
|
||||
if(this.ports[this.routes.blue]){
|
||||
return this.ports[this.routes.blue] * 255;
|
||||
}
|
||||
@@ -73,10 +73,10 @@ function Brush()
|
||||
{
|
||||
ronin.commander.blur();
|
||||
|
||||
this.ports.speed = distance_between(line.from,line.to)/15.0;
|
||||
this.ports.distance += this.ports.speed;
|
||||
this.ports.noise = Math.random(255/255.0);
|
||||
this.ports.x = line.from.x/2;
|
||||
// this.ports.speed = distance_between(line.from,line.to)/15.0;
|
||||
// this.ports.distance += this.ports.speed;
|
||||
// this.ports.noise = Math.random(255/255.0);
|
||||
// this.ports.x = line.from.x/2;
|
||||
|
||||
for(pointer_id in this.pointers){
|
||||
this.pointers[pointer_id].stroke(line);
|
||||
|
||||
@@ -7,7 +7,6 @@ function Line()
|
||||
this.methods = {};
|
||||
|
||||
this.ports = {};
|
||||
this.ports.index = 0;
|
||||
|
||||
this.methods.tween = function(q)
|
||||
{
|
||||
|
||||
9
sources/scripts/port.js
Normal file
9
sources/scripts/port.js
Normal file
@@ -0,0 +1,9 @@
|
||||
function Port(name,input,output,value,max,docs)
|
||||
{
|
||||
this.name = name;
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.value = value;
|
||||
this.max = max;
|
||||
this.docs = docs;
|
||||
}
|
||||
@@ -63,7 +63,5 @@ function Ronin()
|
||||
this.render.update();
|
||||
this.grid.update();
|
||||
this.guide.update();
|
||||
|
||||
this.commander.input_el.value = "frame crop:$";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user