You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<script type="text/javascript" src="paper.js"></script>
|
|
|
|
<script type="text/javascript" src="baumgen.js"></script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#canvas {
|
|
|
|
width: 1000;
|
|
|
|
height: 1000;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
console.log('ready');
|
|
|
|
var el = document.getElementById('download-svg');
|
|
|
|
console.log(el);
|
|
|
|
el.addEventListener('click', function() {
|
|
|
|
var svgdata = 'data:image/svg+xml;utf8,' + encodeURIComponent(paper.project.exportSVG({asString: true}));
|
|
|
|
var a = document.createElement('a');
|
|
|
|
a.download = 'baumgen.svg';
|
|
|
|
a.href = svgdata;
|
|
|
|
document.body.appendChild(a);
|
|
|
|
a.click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<button id="download-svg">download svg</button>
|
|
|
|
<canvas id="canvas" resize></canvas>
|
|
|
|
</body>
|
|
|
|
</html>
|