-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
amanisky
committed
Nov 30, 2018
1 parent
ca94ab6
commit f386c05
Showing
4 changed files
with
665 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>11、读取 SVG 文件</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<canvas id="c"></canvas> | ||
<script src="./bower_components/jQuery/dist/jquery.js"></script> | ||
<script src="./bower_components/fabric.js/dist/fabric.js"></script> | ||
<script> | ||
var canvas = new fabric.Canvas('c', { width: window.innerWidth, height: window.innerHeight, backgroundColor: '#ccc' }); | ||
fabric.loadSVGFromURL('images/01.svg', function (objects, options) { | ||
var obj = fabric.util.groupSVGElements(objects, options); | ||
for (var i = 1; i < 4; i++) { | ||
obj.clone(function(i) { | ||
return function(clone) { | ||
clone.set({ left: i * 100 }); | ||
canvas.add(clone); | ||
}; | ||
}(i)) | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.