Skip to content

Commit 13ffe8d

Browse files
committed
Transform, Transition and Animation - Transition-timing-function
1 parent fbcd518 commit 13ffe8d

File tree

2 files changed

+37
-29
lines changed

2 files changed

+37
-29
lines changed

index.html

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

1313
<body>
14-
<div class="one"></div>
15-
<div class="two"></div>
16-
<div class="three"></div>
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>
1720
</body>
1821
</html>

styles.css

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
11
/*
2-
transition: change over time
3-
transition-delay:
4-
shorthand
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
511
*/
612

713
div {
8-
width: 150px;
9-
height: 150px;
10-
display: inline-block;
14+
background: blue;
15+
color: white;
16+
margin: 10px;
17+
width: 100px;
18+
height: 100px;
19+
font-size: 20px;
20+
text-align: center;
21+
transition: all 2s;
1122
}
1223

13-
.one {
14-
background: red;
24+
div:hover {
25+
transform: translateX(200px);
1526
}
1627

17-
.two {
18-
background: blue;
19-
/* transition-property: background, border-radius;
20-
transition-duration: 4s, 2s; */
21-
22-
/* transition delay */
23-
/* transition-delay: 2s; */
28+
.ease {
29+
transition-timing-function: ease;
30+
}
2431

25-
/* Transition shorthand for specific*/
26-
/* transition: background 4s 2s, border-radius 2s 1s; */
32+
.linear {
33+
transition-timing-function: linear;
34+
}
2735

28-
/* Transition shorthand for all */
29-
transition: all 2s 1s;
36+
.ease-in {
37+
transition-timing-function: ease-in;
3038
}
3139

32-
.two:hover {
33-
background: chartreuse;
34-
border-radius: 50%;
35-
transform: scale(2, 2);
36-
margin-top: 50%;
40+
.ease-out {
41+
transition-timing-function: ease-out;
3742
}
3843

39-
.three {
40-
background: green;
44+
.ease-in-out {
45+
transition-timing-function: ease-in-out;
4146
}

0 commit comments

Comments
 (0)