-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawImage.html
More file actions
27 lines (23 loc) · 855 Bytes
/
drawImage.html
File metadata and controls
27 lines (23 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>随风而行之青衫磊落险峰行JSDemo</title>
<script src="BLFES6Lib.js"></script>
</head>
<body>
<canvas id="myCanvas" width="800" height="600" style="border: 1px solid black">你的浏览器还不支持哦</canvas>
<script>
let canvas = document.getElementById("myCanvas");
let context = canvas.getContext('2d');
let render = new BLFRender(context);
let image = new Image();
image.src = "./data/doom3.png";
image.onload = function(e) {
render.drawImage(image);
render.drawImage(image, null, new Rect(10, 400, 100, 100));
render.drawImage(image, new Rect(0, 0, image.width * 0.5, image.height * 0.5), new Rect(500, 100, 200, 100));
}
</script>
</body>
</html>