mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-28 17:02:24 -05:00
30 lines
937 B
HTML
30 lines
937 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Import From File</title>
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
<script type="text/javascript" src="../../dist/paper-full.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.clear();
|
|
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>
|