-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
56 lines (52 loc) · 2.26 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!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>matrix示例</title>
<style>
.rotate__box {
width: 100px;
height: 100px;
background: green;
/* position: absolute; */
}
.rotate {
/* transform: rotate(60deg); */
/* transform-origin: 50px 100px; */
transform: rotate3d(1, 1, 1, 60deg);
/* transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 100, 1, 1); */
}
.gap{
height: 200px;
}
.matrix{
opacity: .2;
/* transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10px, 40px, -10px, 0)
*/
/* transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 100, 1, 1); */
/* transform: matrix3d(0.666667, 0.666667, -0.333333, 0, -0.333333, 0.666667, 0.666667, 0, 0.666667, -0.333333, 0.666667, 0, 0, 0, 0, 1) */
}
</style>
<script src='./dist/index.js'></script>
</head>
<script>
const { matrix3d, matrix } = transform
const matrixStr = matrix3d.getStyleMatrix3d(matrix3d.rotate3d(1, 1, 1, '60deg'))
console.error(matrixStr)
document.querySelector('style').sheet.insertRule(`.matrix{ transform: matrix3d(${matrixStr})}`, 1)
</script>
<body>
<div class='rotate__box rotate'></div>
<div class='rotate__box matrix' style='background:indigo'></div>
<div class='gap'></div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<svg width='1024' height='1024' viewBox="0 0 1024 1024">
<rect fill='orange' x="0" y="0" width="100" height="100" transform="rotate(45, 100, 100)" />
<rect fill='red' x="0" y="0" width="100" height="100" transform="matrix(0.7071067811865476,0.7071067811865475,-0.7071067811865475,0.7071067811865476,99.99999999999999,-41.42135623730951)" />
<!-- <rect fill='red' x="0" y="0" width="100" height="100" transform="matrix(0.5253219888177297,0.8509035245341184,-0.8509035245341184,0.5253219888177297,132.55815357163885,-37.62255133518482)" /> -->
</svg>
</svg>
</body>
</html>