-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
48 lines (44 loc) · 1.26 KB
/
test.php
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
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<style>
body {
margin: 0px;
padding: 0px;
text-align:center;
}
canvas {
border:1px solid #000;
margin:0 auto;
background:skyblue;
}
</style>
</head>
<body>
<canvas id="myCanvas" width="400" height="600"></canvas>
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var imageObj = new Image();
imageObj.onload = function() {
context.drawImage(imageObj, 100-20, 100-20, 40, 40);
context.save();
context.translate(100,100);
context.rotate(45 * Math.PI / 180);
context.translate(-100,-100);
context.drawImage(imageObj, 100-20, 100-20, 40, 40);
//context.restore();
//context.save();
//context.translate(100,100);
//context.rotate(Math.PI/180*45);
//context.drawImage(imageObj, 0, 0, 40, 40);
//context.rotate(-Math.PI/180*45);
//context.restore();
//context.drawImage(imageObj, 200, 200, 40, 40);
};
imageObj.src = '<?php echo $_GET['user'];?>.png';
</script>
</body>
</html>