|
|
@ -53,11 +53,15 @@ function draw_initstate(state) { |
|
|
|
function draw_forward() { |
|
|
|
function draw_forward() { |
|
|
|
return function(p, state) { |
|
|
|
return function(p, state) { |
|
|
|
draw_initstate(state); |
|
|
|
draw_initstate(state); |
|
|
|
if(p.length == 0) { |
|
|
|
if(p.children.length == 0) { |
|
|
|
p.add(new paper.Point(0, 0)); |
|
|
|
p.addChild(new paper.Path()); |
|
|
|
} |
|
|
|
} |
|
|
|
var lastp = p.segments[p.segments.length - 1].point; |
|
|
|
var pp = p.lastChild; |
|
|
|
p.add(lastp.add( |
|
|
|
if(pp.length == 0) { |
|
|
|
|
|
|
|
pp.add(new paper.Point(0, 0)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var lastp = pp.segments[pp.segments.length - 1].point; |
|
|
|
|
|
|
|
pp.add(lastp.add( |
|
|
|
new paper.Point(Math.sin(state.dir), Math.cos(state.dir)) |
|
|
|
new paper.Point(Math.sin(state.dir), Math.cos(state.dir)) |
|
|
|
)); |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
@ -95,7 +99,7 @@ function draw_angle_add(delta) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function draw(word, actions) { |
|
|
|
function draw(word, actions) { |
|
|
|
var p = new paper.Path(); |
|
|
|
var p = new paper.CompoundPath(); |
|
|
|
var state = {}; |
|
|
|
var state = {}; |
|
|
|
for(let w of word) { |
|
|
|
for(let w of word) { |
|
|
|
if(w in actions) { |
|
|
|
if(w in actions) { |
|
|
|