Browse Source

switch from PapserScript to plain JS

master
Fr3deric 6 years ago
parent
commit
1541f5569c
  1. 18
      chaostest/connected-lines.html

18
chaostest/connected-lines.html

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

Loading…
Cancel
Save