Moved all parsing into Query

This commit is contained in:
Devine Lu Linvega
2017-09-27 10:19:06 +13:00
parent f8959216cd
commit 527da673c8
7 changed files with 96 additions and 27 deletions

View File

@@ -18,6 +18,11 @@ function Frame()
{
}
this.methods.crop = function(p)
{
}
this.resize_to = function(size)
{
ronin.frame.settings.width = size.width;

View File

@@ -2,14 +2,17 @@ function Line()
{
Module.call(this,"line");
this.settings = {steps:20};
this.settings = {steps:100};
this.methods = {};
this.ports = {};
this.ports.index = 0;
this.methods.tween = function(q)
{
var from = parse_sequence(q.split(">>")[0]);
var to = parse_sequence(q.split(">>")[1]);
var from = q.from;
var to = q.to;
var s = 0;
while(s < ronin.line.settings.steps){
@@ -20,6 +23,12 @@ function Line()
}
}
this.methods.stroke = function(q)
{
console.log(q)
ronin.line.stroke_multi(q)
}
this.stroke_multi = function(coordinates)
{
var from = coordinates[0];
@@ -45,28 +54,6 @@ function Line()
ctx.closePath();
}
function parse_sequence(seq_str)
{
var a = [];
var parts = seq_str.split("&");
for(part_id in parts){
var part = parts[part_id];
a.push(parse_unit(part));
}
return a;
}
function parse_unit(unit_str)
{
if(unit_str.indexOf(",") > -1){
return {x:parseInt(unit_str.split(",")[0]),y:parseInt(unit_str.split(",")[1])};
}
if(unit_str.indexOf("x") > -1){
return {width:parseInt(unit_str.split("x")[0]),height:parseInt(unit_str.split("x")[1])};
}
}
function tween_positions(froms,tos,progress)
{
var a = [];