-
Notifications
You must be signed in to change notification settings - Fork 26
/
demo.html
36 lines (32 loc) · 977 Bytes
/
demo.html
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
28
29
30
31
32
33
34
35
36
<!doctype html>
<html>
<head>
<title>Perspective.js demo</title>
<style>
canvas {
border: gray solid 1px;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script src="../dist/perspective.js"></script>
<script>
var canvas = document.getElementById("canvas");
var image = new Image();
image.onload = function() {
canvas.width = image.width;
canvas.height = image.height;
var ctx = canvas.getContext("2d");
var p = new Perspective(ctx, image);
p.draw([
[30, 30],
[image.width - 50, 50],
[image.width - 70, image.height - 30],
[10, image.height]
]);
}
image.src = "firefox.jpg";
</script>
</body>
</html>