-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnimationenCSS.html
134 lines (117 loc) · 3.12 KB
/
AnimationenCSS.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
<!DOCTYPE html>
<html lang="de">
<head>
<title>Beipsiel 1</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body
{
font-family: -apple-system, BlinkMacSystemFont, "segoe ui", roboto, oxygen, ubuntu, cantarell, "fira sans", "droid sans", "helvetica neue", Arial, sans-serif;
}
/* Bsp1 */
.bsp1
{
width: 100px; height: 100px; background: red;
animation-name: bsp1Keyframe;
animation-duration: 4s;
}
@keyframes bsp1Keyframe
{
from {background: red;}
to {background: yellow;}
}
/* Bsp2 */
.bsp2
{
width: 100px; height: 100px; background: red;
animation-name: bsp2Keyframe;
animation-duration: 4s;
}
@keyframes bsp2Keyframe
{
0% {background: red;}
25% {background: yellow;}
50% {background: blue;}
100% {background: green;}
}
/* Bsp3 */
.bsp3
{
width: 100px; height: 100px; background: red;
position: relative; /* is positioned relativ to its normal position */
animation-name: bsp3Keyframe;
animation-duration: 4s;
}
@keyframes bsp3Keyframe
{
0% {background: red; left: 0px; top: 0px;}
25% {background: yellow; left: 200px; top: 0px;}
50% {background: blue; left: 200px; top: 200px;}
75% {background: green; left: 0px; top: 200px;}
100% {background: red; left: 0px; top: 0px;}
}
/* Bsp4 */
.bsp4
{
width: 100px; height: 100px; background: red;
position: relative;
animation-name: bsp1Keyframe;
animation-duration: 4s;
animation-delay: 2s; /* negative Werte sind auch erlaubt !! */
}
/* Bsp5 */
.bsp5
{
width: 100px; height: 100px; background: red;
position: relative;
animation-name: bsp1Keyframe;
animation-duration: 4s;
animation-iteration-count: 3; /* auch infinite */
}
/* Bsp6 */
.bsp6
{
width: 100px; height: 100px; background: red;
position: relative;
animation-name: bsp1Keyframe;
animation-duration: 4s;
animation-fill-mode: forwards; /* or none, backwards, both */
}
@keyframes bsp6Keyframe
{
from {top: 0px;}
to {top: 200px; background-color: blue;}
}
</style>
</head>
<body>
<h1>Animationen mit Keyframes</h1>
<hr>
<!-- -->
<h2>Bsp1</h2>
<div class="bsp1"></div>
<!-- -->
<h2>Bsp2</h2>
<div class="bsp2"></div>
<!-- -->
<h2>Bsp3</h2>
<div class="bsp3"></div>
<!-- -->
<h2>Bsp4 - Delay</h2>
<p>The <code>animation-delay</code> property specifies a delay for the start of an animation.</p>
<div class="bsp4"></div>
<!-- -->
<h2>Bsp5 - How Many Times an Animation Should Run</h2>
<p>The <code>animation-iteration-count</code> property specifies the number of times an animation should run.</p>
<div class="bsp5"></div>
<!-- -->
<h2>Bsp6 - Specify the fill-mode For an Animation</h2>
<p>The <code>animation-iteration-count</code> property specifies the number of times an animation should run.</p>
<div class="bsp6"></div>
<!-- -->
<h2>More about keyframes</h2>
<a target="_blank" href="https://www.w3schools.com/css/css3_animations.asp">For more click here</a><br>
<a target="_blank" href="https://dev.to/ljcdev/introduction-to-css-animation-4762">Oder auch hier</a>
</body>
</html>