Skip to content

Commit e82ad1d

Browse files
committed
Transform, Transition and Animation - Animation
1 parent 13ffe8d commit e82ad1d

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

index.html

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

1313
<body>
14-
<div class="default">default</div>
15-
<div class="ease">ease</div>
16-
<div class="linear">linear</div>
17-
<div class="ease-in">ease-in</div>
18-
<div class="ease-out">ease-out</div>
19-
<div class="ease-in-out">ease-in-out</div>
14+
<div class="transition">transition</div>
15+
<div class="animation">animation</div>
2016
</body>
2117
</html>

styles.css

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,50 @@
11
/*
2-
how the transition takes place
3-
transition-timing-function
4-
transition:all 3s here 5s;
5-
ease = default
6-
ease = slow start, fast, slow end
7-
linear = same speed start to end
8-
ease-in = slow start
9-
ease-out = slow end
10-
ease-in-out = slow start,fast, slow end
2+
Transtion 0 = 100%
3+
from start state to end state
4+
ANIMATION 0 1% 2% .... 100%
5+
multiple states
116
*/
127

138
div {
14-
background: blue;
9+
width: 200px;
10+
height: 200px;
1511
color: white;
16-
margin: 10px;
17-
width: 100px;
18-
height: 100px;
19-
font-size: 20px;
20-
text-align: center;
21-
transition: all 2s;
12+
margin: 20px;
2213
}
2314

24-
div:hover {
25-
transform: translateX(200px);
15+
.transition {
16+
background: red;
17+
transition: all 2s linear;
2618
}
2719

28-
.ease {
29-
transition-timing-function: ease;
30-
}
31-
32-
.linear {
33-
transition-timing-function: linear;
34-
}
35-
36-
.ease-in {
37-
transition-timing-function: ease-in;
20+
.transition:hover {
21+
background: blue;
22+
transform: translateX(200px);
3823
}
3924

40-
.ease-out {
41-
transition-timing-function: ease-out;
25+
.animation {
26+
background: blue;
27+
/* animation-name: move;
28+
animation-duration: 10s;
29+
animation-iteration-count: 3; */
30+
animation: move 3s infinite;
4231
}
4332

44-
.ease-in-out {
45-
transition-timing-function: ease-in-out;
33+
@keyframes move {
34+
0% {
35+
background: red;
36+
transform: translateX(50px);
37+
}
38+
50% {
39+
background: green;
40+
transform: translateX(200px);
41+
}
42+
75% {
43+
background: fuchsia;
44+
transform: translateX(-200px);
45+
}
46+
100% {
47+
background: aqua;
48+
transform: translateX(50px);
49+
}
4650
}

0 commit comments

Comments
 (0)