Skip to content

Commit cec2337

Browse files
committed
Transform, Transition and Animation - animation-fill-mode
1 parent e82ad1d commit cec2337

File tree

2 files changed

+11
-24
lines changed

2 files changed

+11
-24
lines changed

index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</head>
1212

1313
<body>
14-
<div class="transition">transition</div>
1514
<div class="animation">animation</div>
1615
</body>
1716
</html>

styles.css

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,38 @@
11
/*
2-
Transtion 0 = 100%
3-
from start state to end state
4-
ANIMATION 0 1% 2% .... 100%
5-
multiple states
2+
animation-fill-mode:what values are applied by the animation outside the time it is executing.
63
*/
74

85
div {
96
width: 200px;
107
height: 200px;
118
color: white;
129
margin: 20px;
13-
}
14-
15-
.transition {
16-
background: red;
17-
transition: all 2s linear;
18-
}
19-
20-
.transition:hover {
21-
background: blue;
22-
transform: translateX(200px);
10+
opacity: 0;
2311
}
2412

2513
.animation {
2614
background: blue;
27-
/* animation-name: move;
28-
animation-duration: 10s;
29-
animation-iteration-count: 3; */
30-
animation: move 3s infinite;
15+
animation: move 3s 3;
16+
animation-fill-mode: forwards;
3117
}
3218

3319
@keyframes move {
3420
0% {
35-
background: red;
21+
opacity: 0.1;
22+
}
23+
25% {
24+
opacity: 0.25;
3625
transform: translateX(50px);
3726
}
3827
50% {
39-
background: green;
28+
opacity: 0.5;
4029
transform: translateX(200px);
4130
}
4231
75% {
43-
background: fuchsia;
44-
transform: translateX(-200px);
32+
opacity: 0.75;
4533
}
4634
100% {
47-
background: aqua;
35+
opacity: 1;
4836
transform: translateX(50px);
4937
}
5038
}

0 commit comments

Comments
 (0)