|
|
@ -7,26 +7,24 @@ |
|
|
|
<head> |
|
|
|
<head> |
|
|
|
<script type="text/javascript" src="paper.js"></script> |
|
|
|
<script type="text/javascript" src="paper.js"></script> |
|
|
|
<script type="text/javascript" src="connected-lines.js" canvas="canvas"></script> |
|
|
|
<script type="text/javascript" src="connected-lines.js" canvas="canvas"></script> |
|
|
|
<script type="text/paperscript" canvas="canvas"> |
|
|
|
<script type="text/javascript"> |
|
|
|
function draw() { |
|
|
|
function draw() { |
|
|
|
paper.project.clear(); |
|
|
|
paper.project.clear(); |
|
|
|
var grp = connected_lines(); |
|
|
|
var grp = connected_lines(); |
|
|
|
grp.scale(500, new Point(0,0)); |
|
|
|
grp.scale(500, new Point(0,0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
globals.draw = draw; |
|
|
|
function get_svg() { |
|
|
|
globals.get_svg = function() { |
|
|
|
return paper.project.exportSVG({asString: true}); |
|
|
|
return project.exportSVG({asString: true}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
window.globals = {} |
|
|
|
|
|
|
|
window.onload = function() { |
|
|
|
window.onload = function() { |
|
|
|
paper.install(window); |
|
|
|
paper.install(window); |
|
|
|
window.globals.draw(); |
|
|
|
paper.setup(document.getElementById('canvas')); |
|
|
|
|
|
|
|
draw(); |
|
|
|
|
|
|
|
|
|
|
|
document.getElementById('download-svg').addEventListener('click', function() { |
|
|
|
document.getElementById('download-svg').addEventListener('click', function() { |
|
|
|
var svgdata = 'data:image/svg+xml;utf8,' + encodeURIComponent(window.globals.get_svg()); |
|
|
|
var svgdata = 'data:image/svg+xml;utf8,' + encodeURIComponent(get_svg()); |
|
|
|
var a = document.createElement('a'); |
|
|
|
var a = document.createElement('a'); |
|
|
|
a.download = 'export.svg'; |
|
|
|
a.download = 'export.svg'; |
|
|
|
a.href = svgdata; |
|
|
|
a.href = svgdata; |
|
|
@ -35,7 +33,7 @@ window.onload = function() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
document.getElementById('draw').addEventListener('click', function() { |
|
|
|
document.getElementById('draw').addEventListener('click', function() { |
|
|
|
window.globals.draw(); |
|
|
|
draw(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|