728x90
CSS : μ λλ©λμ λ§λ€κΈ° : μμ°μ°μ°μ± λμ΄λλ μμ μ λλ©μ΄μ
μ΄λ² μκ°μλ CSS μ€μ΅μΌλ‘ μμκ° λμκ°λ€κ° μμ°μ°μ± λμ΄λλ μ λλ©μ΄μ μ λ§λ€μ΄λ³΄κ² μ΅λλ€~~!
#1. HTML
μμμ λ©΄ κ°―μλ§νΌ divλ₯Ό λ§λ€μ΄ μ£Όμλ©΄ λ©λλ€.
<div class="cube">
<div>ν 맀ν </div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
#2. CSS
λ€μμ CSS μ½λ μ λλ€!
body {
background-color: CadetBlue;
height: 100vh;
perspective: 1000px;
display: flex;
align-items: center;
justify-content: center;
}
.cube {
position: relative;
width: 100px;
height: 100px;
transform-style: preserve-3d;
transform: rotatex(-20deg) rotatey(-140deg) translatez(0);
animation: rotate 8000ms linear infinite;
}
.cube div {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
opacity: 0.75;
color: #fff;
}
.cube div:nth-child(1) {
background-color: #ffcc80;
transform-origin: center top;
transform: rotatex(90deg) translatey(-100px);
animation: top 4000ms ease-in-out 8000ms infinite
}
.cube div:nth-child(2) {
background-color: #ffb74d;
transform-origin: center bottom;
transform: rotatex(-90deg) translatey(100px);
animation: bottom 4000ms ease-in-out 8000ms infinite
}
.cube div:nth-child(3) {
background-color: #ffa726;
transform-origin: left center;
transform: rotatey(-90deg) translatex(-100px);
animation: left 4000ms ease-in-out 8000ms infinite
}
.cube div:nth-child(4) {
background-color: #ff9800;
transform-origin: right center;
transform: rotatey(90deg) translatex(100px);
animation: right 4000ms ease-in-out 8000ms infinite
}
.cube div:nth-child(5) {
background-color: #fb8c00;
transform-origin: center center;
transform: rotatex(0deg);
animation: front 4000ms ease-in-out 8000ms infinite
}
.cube div:nth-child(6) {
background-color: #ffb74d;
transform-origin: center center;
transform: rotatey(-180deg) translatez(100px);
animation: back 4000ms ease-in-out 8000ms infinite
}
@keyframes rotate {
0% {
transform: rotatex(0) rotatey(0) rotatez(0) translatez(0)
}
100% {
transform: rotatex(360deg) rotatey(360deg) rotatez(360deg) translatez(0)
}
}
@keyframes top {
0% {
transform: rotatex(90deg) translatey(-100px) translatez(0)
}
50% {
transform: rotatex(90deg) translatey(-100px) translatez(100px)
}
100% {
transform: rotatex(90deg) translatey(-100px) translatez(0)
}
}
@keyframes bottom {
0% {
transform: rotatex(-90deg) translatey(100px) translatez(0);
}
50% {
transform: rotatex(-90deg) translatey(100px) translatez(100px);
}
100% {
transform: rotatex(-90deg) translatey(100px) translatez(0);}
}
@keyframes left {
0% {
transform: rotatey(-90deg) translatex(-100px) scaley(1);
}
50% {
transform: rotatey(-90deg) translatex(-100px) scaley(3);
}
100% {
transform: rotatey(-90deg) translatex(-100px) scaley(1);
}
}
@keyframes right {
0% {
transform: rotatey(90deg) translatex(100px) scaley(1);
}
50% {
transform: rotatey(90deg) translatex(100px) scaley(3);
}
100% {
transform: rotatey(90deg) translatex(100px) scaley(1);
}
}
@keyframes front {
0% {
transform: rotatex(0deg) scaley(1);
}
50% {
transform: rotatex(0deg) scaley(3);
}
100% {
transform: rotatex(0deg) scaley(1);
}
}
@keyframes back {
0% {
transform: rotatey(180deg) translatez(100px) scaley(1);
}
50% {
transform: rotatey(180deg) translatez(100px) scaley(3);
}
100% {
transform: rotatey(180deg) translatez(100px) scaley(1);
}
}
#3. 결과보기
728x90
'CSS' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[CSS] μ λλ©μ΄μ 09 : 컀μλ°λΌ μμ§μ΄λ EYES~~π (2) | 2022.09.29 |
---|---|
[CSS] μ λλ©μ΄μ 08 : λΉκΈ~λΉκΈ~ λμκ°λ λ‘λ©~ (2) | 2022.09.29 |
[CSS] μ λλ©μ΄μ 06 : ν΅!ν΅!ν΅! ν μ€νΈ (2) | 2022.09.29 |
[CSS] μ λλ©μ΄μ 05 : κΉμ¦€λλ μ 체 ν¨κ³Ό (5) | 2022.09.21 |
[CSS] μ λλ©μ΄μ 04 : μ¨μ΄λΈ~~μ¨μ΄λΈ~~ (6) | 2022.09.19 |
λκΈ