forked from 4iz268/cviceni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-transform.html
141 lines (91 loc) · 2.71 KB
/
css-transform.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>CSS Transform</title>
<style type="text/css">
body {
margin: 50px;
}
div {
width: 100px;
height: 100px;
border: 1px solid black;
}
h2 {
margin-top: 50px;
}
/* rotate = otoceni o stupne */
div.rotate {
-ms-transform: rotate(19deg); /* IE 9 */
-webkit-transform: rotate(19deg); /* Chrome, Safari, Opera */
transform: rotate(19deg);
}
/* scale = skalovani = zmena velikosti, nasobky, 1 = skutecna velikost, osa X (1.3), Y (0.7) */
div.scale {
-ms-transform: scale(1.3, 0.7); /* IE 9 */
-webkit-transform: scale(1.3, 0.7); /* Chrome, Safari, Opera */
transform: scale(1.3, 0.7);
}
/* vsechny 2D animace spojene do 1 funkce, nedoporucuji pouzivat rucne, ale nechat si vygenerovat napr. pres http://meyerweb.com/eric/tools/matrix/ */
div.matrix {
transform: matrix(0.707107, 0.707107, -0.707107, 0.707107, 0, 0); /* prevedena rotate (45deg) */
}
/* translate = posunuti, osa X, osa Y */
div.translate {
-ms-transform: translate(50px, 50px); /* IE 9 */
-webkit-transform: translate(50px, 50px); /* Chrome, Safari, Opera */
transform: translate(50px, 50px);
}
/* skew = zesikmeni */
div.skew {
-ms-transform: skew(40deg, 30deg);
-webkit-transform: skew(40deg, 30deg);
transform: skew(40deg, 30deg);
}
/* kombinace nekolik transformaci v 1 css vlastnosti */
div.combined {
-ms-transform: translateX(10px) rotate(10deg) translateY(5px);
-webkit-transform: translateX(10px) rotate(10deg) translateY(5px);
transform: translateX(10px) rotate(10deg) translateY(5px);
}
/* perspective = z jake dalky se budeme divat na 3D objekt */
div.perspective1 {
position: relative;
height: 150px;
width: 150px;
margin: 50px;
padding: 10px;
border: 1px solid black;
-webkit-perspective: 150px; /* Chrome, Safari, Opera */
perspective: 150px;
}
div.perspective2 {
padding: 20px;
border: 1px solid black;
background-color: red;
-webkit-transform: rotateX(45deg); /* Chrome, Safari, Opera */
transform: rotateX(45deg);
}
</style>
</head>
<body>
<h1>CSS Transform</h1>
<h2>Rotate</h2>
<div class="rotate" style="background-color: red"></div>
<h2>Scale</h2>
<div class="scale" style="background-color: green"></div>
<h2>Matrix</h2>
<div class="matrix" style="background-color: lightblue"></div>
<h2>Translate</h2>
<div class="translate" style="background-color: purple"></div>
<h2>Skew</h2>
<div class="skew" style="background-color: gold"></div>
<h2>Transform combined</h2>
<div class="combined" style="background-color: orange"></div>
<h2>Perspective</h2>
<div class="perspective1">
<div class="perspective2"></div>
</div>
</body>
</html>