mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Simplify SVG export examples.
This commit is contained in:
parent
f38d3ee674
commit
0060f629ae
19 changed files with 20 additions and 39 deletions
|
@ -23,11 +23,10 @@
|
|||
var path = new Path.Circle(new Point(50, 50), 25);
|
||||
path.fillColor = 'red';
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,11 +13,10 @@
|
|||
var path2 = new Path.Rectangle([50, 50], [200, 200]);
|
||||
var path3 = new Path.Rectangle([0, 0], [400, 400]);
|
||||
new CompoundPath(path1, path2, path3);
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
|
||||
var path3 = new Path();
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -43,11 +43,10 @@
|
|||
|
||||
rect.rotate(45).scale(0.7);
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="300" height="600"></canvas>
|
||||
<svg id="svg" width="300" height="600"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
group.translate([100, 100]);
|
||||
group.scale(0.5);
|
||||
group.rotate(10);
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -32,11 +32,10 @@
|
|||
line3.strokeColor = "yellow";
|
||||
line3.strokeWidth = "5";
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -30,11 +30,10 @@
|
|||
var path = new Path.Star(center, points, radius1, radius2);
|
||||
path.fillColor = 'black';
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -44,11 +44,10 @@
|
|||
path4.strokeColor= 'yellow';
|
||||
path4.fillColor='purple';
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -71,11 +71,10 @@
|
|||
fillColor: '#99c'
|
||||
});
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG({ matchShapes: true }));
|
||||
document.body.appendChild(project.exportSVG({ matchShapes: true }));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
fillColor: 'yellow'
|
||||
});
|
||||
rect.rotate(-20);
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
|
||||
var prev = null;
|
||||
function onMouseMove(event) {
|
||||
|
@ -54,6 +54,5 @@
|
|||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
p1.rotate(45);
|
||||
var p2 = symbol.place([300, 200]);
|
||||
p2.rotate(-30);
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -36,11 +36,10 @@
|
|||
c.fillColor = colors[i];
|
||||
}
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,12 +13,11 @@
|
|||
project.importJSON(tiger);
|
||||
console.log('Load JSON', Date.now() - start);
|
||||
var start = Date.now();
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
console.log('Export SVG', Date.now() - start);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="600" height="600"></canvas>
|
||||
<svg id="svg" width="600" height="600"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -20,11 +20,10 @@
|
|||
clonedPath.rotate(angle * i, circlePath.bounds.topLeft);
|
||||
};
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
copy.rotate(-45);
|
||||
copy.scale(0.5);
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<svg id="svg" width="500" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
all.position = view.center;
|
||||
|
||||
var svg = project.exportSVG();
|
||||
document.getElementById('svg').appendChild(svg);
|
||||
document.body.appendChild(svg);
|
||||
//console.log(svg, new XMLSerializer().serializeToString(svg));
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
<link rel="stylesheet" href="../css/style.css">
|
||||
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
||||
<script type="text/paperscript" canvas="canvas">
|
||||
// view._context = new ProxyContext(view._context);
|
||||
// view.zoom = 1.25;
|
||||
view.zoom = 1.5;
|
||||
settings.applyMatrix = false;
|
||||
var path = new Path.Circle({
|
||||
center: view.center - [0, 140],
|
||||
|
@ -56,11 +55,10 @@
|
|||
hole.position += 15;
|
||||
compound.scale(2, 1);
|
||||
|
||||
document.getElementById('svg').appendChild(project.exportSVG());
|
||||
document.body.appendChild(project.exportSVG());
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="300" height="500"></canvas>
|
||||
<svg id="svg" width="300" height="500"></svg>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue