728x90
애니메이션 만들기
애니메이션 : 움직이는 사진
움직이는 사진을 만들어 봅시다.
@font-face {
font-family: 'LocusSangsang';
font-weight: normal;
font-style: normal;
src: url('https://cdn.jsdelivr.net/gh/webfontworld/locus/LocusSangsang.eot');
src: url('https://cdn.jsdelivr.net/gh/webfontworld/locus/LocusSangsang.eot?#iefix') format('embedded-opentype'),
url('https://cdn.jsdelivr.net/gh/webfontworld/locus/LocusSangsang.woff2') format('woff2'),
url('https://cdn.jsdelivr.net/gh/webfontworld/locus/LocusSangsang.woff') format('woff'),
url('https://cdn.jsdelivr.net/gh/webfontworld/locus/LocusSangsang.ttf') format("truetype");
font-display: swap;
}
body {
font-family: "LocusSangsang";
background-image: linear-gradient(135deg, #191970 0%, #483D8B 40%, #9370DB 100%);
height: 100vh;
}
.hover__wrap {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.hover__wrap > div {
max-width: 400px;
margin: 3%;
position: relative;
perspective: 500px;
}
.hover__wrap > div img {
max-width: 100%;
border: 10px solid #f0f8FF;
box-shadow: 2px 2px 2px 2px rgba(0,0,0,0.2);
box-sizing: border-box;
vertical-align:top;
}
.hover__wrap > div .front,
.hover__wrap > div .front{
transition: transform 1s;
backface-visibility: hidden;
transform-style: preserve-3d;
}
.hover__wrap > div .back {
position: absolute;
left: 0;
top: 0;
z-index: -1;
transition: transform 1s;
backface-visibility: hidden;
transform-style: preserve-3d;
}
.hover__wrap > div figcaption {
background: rgba(0,0,0,0.4);
color: #f8f8ff;
padding: 10px;
line-height: 1.5;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) translatez(100px);
width: 60%;
backface-visibility: hidden;
}
/* mouse hover effect */
.hover__updown .front {
transform: rotateY(0deg);
}
.hover__updown:hover .front {
transform: rotateX(180deg);
}
.hover__updown .back {
transform: rotateX(-180deg);
}
.hover__updown:hover .back {
transform: rotateX(0deg);
z-index: 1;
}
.hover__leftright .front {
transform: rotateY(0deg);
}
.hover__leftright:hover .front {
transform: rotateY(180deg);
}
.hover__leftright .back {
transform: rotateY(-180deg);
}
.hover__leftright:hover .back {
transform: rotateY(0deg);
z-index: 1;
}
728x90
반응형
'CSS > Animation' 카테고리의 다른 글
css애니메이션 - 움직이는 박스 (2) | 2022.09.27 |
---|---|
css애니메이션 - 통통튀는 글자 (2) | 2022.09.27 |
CSS 애니메이션 - 웨이브 (1) | 2022.09.19 |
CSS 애니메이션 - 움직이는 공2 (2) | 2022.09.19 |
애니메이션 - 텍스트 가 그려지는 효과 (13) | 2022.09.08 |
댓글