<div class="transform"></div>
.transform {
width: 300px;
height: 300px;
background-color: yellow;
margin-top: 100px;
margin-left: 100px;
.transform {
transform: rotate(45deg);
}
.transform {
transform: scale(2, 3);
}
.transform {
transform: skew(10deg, 20deg);
}
.transform {
transform: translate(100px, 300px);
}
.transform {
-webkit-transform: rotate(10deg);
-moz-transform: rotate(10deg);
-ms-transform: rotate(10deg);
-o-transform: rotate(10deg);
transform: rotate(10deg);
}
<div class="transition"></div>
.transition {
width: 300px;
height: 300px;
background-color: yellow;
}
.transition:hover {
width: 600px;
}
.transition {
transition-property: width;
transition-duration: 2s;
transition-timing-function: linear;
transition-delay: 1s;
}
.transition {
transition: width 2s linear 1s
}
.transition {
transition: width 2s linear 1s, height 2s linear;
}
.transition:hover {
width: 600px;
height: 600px;
}
.animation {
width: 300px;
height: 300px;
background-color: tomato;
animation-name: changeWidth;
animation-duration: 3s;
animation-timing-function: linear;
animation-delay: 1s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes changeWidth {
0% {
width: 300px;
height: 300px;
background-color: tomato;
border: solid 0px blue;
}
50% {
background-color: brown;
}
100% {
width: 600px;
height: 600px;
background-color: yellowgreen;
border: solid 10px blue;
}
}
<div class="spin-lion"></div>
.spin-lion {
width: 150px;
height: 150px;
background-color: blue;
.spin-lion {
animation: spinLion 1500ms linear infinite alternate;
}
@keyframes spinLion {
from { transform: rotate(-10deg); }
to { transform: rotate(10deg); }
}
.spin-lion {
-webkit-animation: spinLion 1500ms linear infinite alternate;
animation: spinLion 1500ms linear infinite alternate;
}
@-webkit-keyframes spinLion {
from { -webkit-transform: rotate(-10deg); }
to { -webkit-transform: rotate(10deg); }
}
@keyframes spinLion {
from { transform: rotate(-10deg); }
to { transform: rotate(10deg); }
}
<nav class="mouse-animation">
<ul>
<li><a href="#">메뉴1</a></li>
<li><a href="#">메뉴2</a></li>
<li><a href="#">메뉴3</a></li>
<li><a href="#">메뉴4</a></li>
</ul>
</nav>
.mouse-animation li {
width: 250px;
background-color: #000000;
padding: 20px;
border-top: solid 5px #dfdfdf;
}
.mouse-animation li a {
color: #ffffff;
font-size: 20px;
}
.mouse-animation li {
transition: opacity 0.5s, margin-left 0.5s;
}
.mouse-animation li:hover {
opacity: 0.5;
margin-left: 10px;
}
.mouse-animation li {
width: 250px;
background-color: rgba(0,0,0,1);
}
.mouse-animation li:hover {
background-color: rgba(0,0,0,0.5);
}
<div class="move-box"></div>
.move-box {
poistion: relative;
width: 200px;
height: 200px;
background-color: red;
.mover-box {
animation-name: moveBox;
animation-duration: 4s;
animation-timing-function: linear;
animation-delay: 1s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes moveBox {
0% {
background-color: green;
left: 0;
top: 0;
}
25% {
background-color: yellow;
left: 500px;
top: 0px;
}
50% {
background-color: gray;
left: 500px;
top: 500px;
border-radius: 50%;
}
75% {
background-color: blue;
left: 0px;
top: 500px;
}
100% {
background-color: red;
top: 0;
left: 0;
}
}
.mover-box {
animation-play-state: paused;
animation-fill-mode: backwards;
<div class="outer-border">
<div class="inner-border"></div>
</div>
.outer-border {
display: flex;
justify-content: center;
align-items: center;
width: 200px;
height: 200px;
border: solid 15px red;
border-radius: 50%;
}
.outer-border {
animation: outerBorder 2s infinite;
}
@keyframes outerBorder {
0% { border-color: red; transform: scale(1);}
25% { border-color: yellow; transform: scale(1.2);}
50% { border-color: blue; transform: scale(1.3);}
75% { border-color: green; transform: scale(1.2);}
100% { border-color: pink; transform: scale(1);}
}
.outer-border {
margin: 0 auto;
margin-top: 200px
}
.inner-border {
width: 75px;
height: 75px;
border: 5px solid purple;
}
.inner-border {
animation: innerBorder 2s infinite alternate;
}
@keyframes innerBorder {
0% { transform: rotate(0deg);}
25% { border-color: blue; border-width: 10px;}
50% { border-color: yellow; border-width: 20px;}
75% { border-color: green; border-width: 40px;}
100% { transform: rotate(360deg); border-color: gray; border-width: 5px;}
}
.inner-border {
box-sizing: border-box;
}
<div class="mario-container">
<div class="mario-coin"></div>
<div class="mario-box"></div>
<div>
.mario-container {
position: relative;
width: 500px;
height: 500px;
border: solid 10px black;
margin: 0 auto;
margin-top: 200px;
}
.mario-container .mario-coin {
position: relative;
width: 70px;
height: 70px;
background-color: yellow;
margin: 0 auto;
margin-top: 100px;
border-radius: 50%;
}
.mario-container .mario-box {
position: relative;
width: 100px;
height: 100px;
background-color: blue;
margin: 0 auto;
}
.mario-container .mario-box {
animation: jumpBox 0.5s linear infinite alternate;
}
@keyframes jumpBox {
0% {transform: translateY(0px);}
50% {transform: translateY(-10px);}
100% {transform: translateY(0px);}
}
.mario-container .mario-coin {
animation: jumpCoin 0.8s linear infinite;
}
@keyframes jumpCoin {
0% {transform: translateY(0);
opacity: 1;
}
50% {transform: translateY(-100px);
opacity: 0;
}
100% {transform: translateY(-100px);
opacity: 0;
}
}
@keyframes jumpCoin {
0% {transform: translateY(0);
opacity: 1;
}
50% {transform: translateY(-100px) rotateY(180deg);
opacity: 0;
}
100% {transform: translateY(-100px) rotateY(360deg);
opacity: 0;
}
}
<div class="hover-image">
<img src="https://img.pngio.com(add).png">
</div>
.hover-image {
width: 400px;
border: solid 10px #000000;
}
hover-image img {
width: 100%;
}
.hover-image img {
vertical-align: middle;
}
.hover-image .image-info {
background-color: rgba(0, 0, 0, 0.5);
padding: 20px;
}
.hover-image .image-info h2,
.hover-image .image-info p {
margin: 0;
padding: 0;
color: #ffffff;
}
.hover-image .image-info h2 {
font-size: 20px;
}
.hover-image .image-info p {
font-size: 15px;
}
.hover-image .image-info {
position: absolute;
}
.hover-image .image-info {
box-sizing: border-box;
width: 100%;
.hover-image .image-info {
left: 0;
bottom: 0;
}
.hover-image:hover img {
transform: scale(1.3);
}
.hover-image img {
transition: transform 0.3s linear;
}
.hover-image {
cursor: pointer;
overflow: hidden;
}
.hover-image .image-info {
bottom: -85px;
transition: bottom 0.3s linear;
.hover-image:hover .image-info {
bottom: 0;
}
css 애니메이션 속성 재밌기도 했지만 부모로 물려받는 부분에서 살짝 헷갈렸다.
선생님께서 알려주신 유용한 사이트를 계속 하다보니 익숙함에 저절로 이해가 되었다.
일단 웹사이트로 애니메이션을 만들었다는게 굉장히 보람차고 생각보다 어렵지 않은 방법으로 애니메이션을 만들 수 있어서 자신감이 돋는 시간이였다.