mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Include example to illustrate loading from local files.
This commit is contained in:
parent
1637a31ad7
commit
6425a01bbd
1 changed files with 29 additions and 0 deletions
29
examples/SVG Import/From File.html
Normal file
29
examples/SVG Import/From File.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Rect Testing</title>
|
||||
<link rel="stylesheet" href="../css/style.css">
|
||||
<script type="text/javascript" src="../../dist/paper.js"></script>
|
||||
<script type="text/paperscript" canvas="canvas">
|
||||
var file = document.getElementById('file');
|
||||
file.addEventListener('change', function (event) {
|
||||
var files = event.target.files;
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var file = files[i];
|
||||
if (file.type.match('svg')) {
|
||||
project.importSVG(file, function(item) {
|
||||
console.log(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<input type="file" id="file">
|
||||
</form>
|
||||
<canvas id="canvas" width="1000" height="1000"></canvas>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue