Browse Source

add rudimentary svg export

master
Fr3deric 6 years ago
parent
commit
dadfbb34bd
  1. 17
      baumgen.html

17
baumgen.html

@ -10,8 +10,25 @@
} }
</style> </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> </head>
<body> <body>
<button id="download-svg">download svg</button>
<canvas id="canvas" resize></canvas> <canvas id="canvas" resize></canvas>
</body> </body>
</html> </html>

Loading…
Cancel
Save