/
sample03.html
58 lines (51 loc) · 1.45 KB
/
sample03.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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSS Transform Demo: サンプル03 変形順を利用した回転アニメーション</title>
<link rel="stylesheet" href="style.css" />
<style>
#charactor1 {
animation: 3s linear 1s infinite cyclic1;
}
@keyframes cyclic1 {
from {
transform: rotate(0deg) translateX(200px);
}
to {
transform: rotate(360deg) translateX(200px);
}
}
#charactor2 {
animation: 3s linear 1s infinite cyclic2;
}
@keyframes cyclic2 {
from {
transform: translateX(200px) rotate(0deg);
}
to {
transform: translateX(200px) rotate(360deg);
}
}
/* 回転軸を示すマーカー */
.origin {
transform: translate(50px, 100px);
}
</style>
</head>
<body>
<h1>03. 変形順を利用した回転アニメーション</h1>
<h2>translate rotateの順</h2>
<div class="stage">
<div class="charactor" id="charactor1"></div>
<div class="origin" id="origin1"></div>
</div>
<h2>rotate translateの順</h2>
<div class="stage">
<div class="charactor" id="charactor2"></div>
<div class="origin" id="origin2"></div>
</div>
</body>
</html>