λͺ©μ°¨
μ§κΈκΉμ§ λ°°μ΄ λ΄μ©λ§μ νμ©νμ¬
λ²νΌ μ‘°μμ ν μ μλ κ°λ¨ν κ²μμ λ§λ€μλ€!
μ½λ
github(https://github.com/Bluishhot-Star/WEB/tree/master/HTML%26CSS/Btn_game)
<div class="title">KASSID GAME</div>
<div class="game">
<div class="left"></div>
<div class="right"></div>
<div class="refresh"></div>
<div class="container">
<div class="victory">VICTORY!</div>
<div class="child"></div>
</div>
</div>
*, *::after, *::before {
box-sizing: border-box;
}
.title {
width: 325px;
text-align: center;
font-weight: bold;
font-size: 25px;
}
.game {
width: 325px;
height: 380px;
padding: 10px;
position: relative;
border: 2px solid #000;
background-color: gray;
}
.left {
display: inline-block;
background-image: url(/images/l_btn.png);
background-size: contain;
border: 2px solid #000;
border-radius: 50%;
width: 40px;
height: 40px;
position: absolute;
left: 30%;
bottom: 10px;
}
.right {
display: inline-block;
background-image: url(/images/r_btn.png);
background-size: contain;
border: 2px solid #000;
border-radius: 50%;
width: 40px;
height: 40px;
margin-top: 5px;
position: absolute;
right: 30%;
bottom: 10px;
}
.refresh {
border: 1px solid #000;
width: 15px;
height: 15px;
position:absolute;
border-radius: 5px;
z-index: 10;
background-image: url(/images/direction.png);
background-size: contain;
}
.right:active ~ .container{
background-position: 100%;
transition-property: background-position;
transition-duration: 2s;
transition-delay: 0s;
}
.right:active ~ .container>.child{
background-color: red;
}
.right:active ~ .container>.victory {
visibility: visible;
opacity: 1;
transition: opacity 1s ease 2s;
}
.left:active ~ .container>.child{
background-color: red;
}
.left:active ~ .container{
background-position: 0%;
transition-property: background-position;
transition-duration: 2s;
}
.refresh:active ~ .container{
background-position: 0%;
transition: background-position 0s;
}
.container {
border: 1px solid #000;
width: 300px;
height: 300px;
position: relative;
background-image: url("/images/stage.png");
background-position: 0px 0px;
transition: background-position 10000s linear;
}
.child {
background-color: #fff;
width: 30px;
height: 30px;
position:absolute;
top: 55%;
left: 50%;
background-image: url(/images/cat.png);
background-size: contain;
background-position: center;
transform: translate(-50%,-50%);
}
.victory {
visibility: hidden;
opacity: 0;
border: 1px solid #000;
background-color: gold;
border-radius: 5px;
text-align: center;
width: 100px;
padding: 2px;
height: 30px;
font-weight: bold;
position:absolute;
top: 30%;
left: 50%;
transform: translate(-50%,-50%);
}
μ½λ©νΈ
μμ§ CSSμ λν΄μ μ λλ‘ μμ§ λͺ»νκ³
animaition λΆλΆμ 곡λΆνμ§ μμμ§λ§
μ§κΈ νμ¬ μκ³ μλ κ²λ€μ ν λλ‘
μ΄κ²μ κ² λ΄ λ§μλλ‘ κ΅¬μ±ν΄μ
κ°λ¨ν νλ‘μ νΈλ₯Ό λ§λ€μ΄ 보μλ€.
μλ§ λμ€μ λ³΄κ² λλ€λ©΄
λΆλλ¬μ΄ μμ€μΌ μ μμ§λ§
μκ°νλ λλ‘ κ²°κ³Όλ¬Όμ΄ λμμ μ’μλ€
λ€μμλ λ λλμκ² λ§λ€μ΄λ³΄κ³ μΆλ€π₯
'π¨βπ | OTHERS > κ°λ°μΌμ§' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
λμ 첫 μΉμ¬μ΄νΈ λ§λ€κΈ°_(1) (0) | 2022.02.04 |
---|---|
ν°μ€ν 리 μ€ν¨ 컀μ€ν ! (w. HTML & CSS) (0) | 2022.01.31 |
HTML & CSS νμ© νλ‘μ νΈ_ κ³ μμ΄ λμ€ μ λλ©μ΄μ λ§λ€κΈ° (0) | 2022.01.16 |
μΉ κ°λ° κ³΅λΆ devlog (0) | 2021.12.27 |
κ°μνκ²½ μ€μ (venv) (w.VSCODE & bash) (0) | 2021.12.03 |
λκΈ