1. copy the code and paste the any text editor.
2. Save the file .html extension
3. Run the web browser (Mozilla Firefox, Google Chrome)
Key Frame example of code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Key Frames 2 </title>
<style>
body{
background: #333;
}
.box{
background: #fff;
width: 200px;
height: 200px;
position: relative;
top: 0;
left: 0;
animation: animate1 5s forwards ease-in-out;
}
@keyframes animate1{
25%{
top: 0;
left: 300px;
background: red;
border-radius: 50% 0 0 0;
}
50%{
top: 300px;
left: 300px;
background: green;
border-radius: 50% 50% 0 0;
}
75%{
top: 300px;
left: 0;
background: blue;
border-radius: 50% 50% 50% 0;
}
100%{
top:0;
left:0;
background: white;
border-radius: 50% 50% 50% 50%;
}
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
Transition example of code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Trasition</title>
<style>
body{
background: #333;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.box{
background: #fff;
width: 100px;
height: 100px;
/* Transition */
/* transition-property: background;
transition-duration: 2s;
transition-timing-function: ease-in-out; */
/* transition-delay: 1s; */
/* Selecting one elements for ttansition */
/* transition: background 2s ease-in-out; */
/* Selecting some elements for transition */
/* transition: background,border-radius 2s ease-in-out; */
/* Selecting all elements for transition */
transition: all 2s ease-in-out;
}
.box:hover{
background: red;
border-radius: 50%;
width: 300px;
height: 300px;
}
/*
TRANSITIONAL PROPERTIES
-Properties that have an identifiable halfway point
background-color
background-position
border-color
border-width
border-spacing
bottom
color
font-size
font-weight
height left
letter-spacing
line-height
margin
max-height
max-width
min-height
min-width
opacity
outline-color
outline-offset
outline-width
padding right
text-indent
text-shadow
top
vertical-align
visibility
width
word-spacing
z-index
*/
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
Transform example of code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Transfrom</title>
<style>
body{
background: #333;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.box{
background: #fff;
width: 300px;
height: 300px;
/* transform: rotate(25deg); */
/* transform: skew(25deg); */
/* transform: scale(2); */
transition: all 1s ease-in-out;
}
.box:hover{
/* transform: rotate(270deg);
transform: skew(25deg);
transform: scale(2); */
/* Move down */
/* transform: translateY(100px); */
/* Move up */
/* transform: translateY(-100px); */
/* transform: translateX(100px);
transform: translate(100px,100px); */
transform: translate3d(100px,100px,100px);
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
No comments:
Post a Comment