HTML๊ณผ CSS๋ฅผ ์ด์ฉํด์ ์์ํ ๋ฌผ๊ฒฐ์ด ์ด๋ ๋ฒํผ์ ๋ง๋ค์๋ค.๐
๋ฒํผ์ ํด๋ฆญํ๋ฉด ๋ฌผ๊ฒฐ์ด ์ผ๋๋ก ํ๋ฉด ๋ ๋ฉ์์ ๊ฒ ๊ฐ๋ค.
๋์ค์ JS๋ฐฐ์ฐ๋ฉด ํ๋ฒ ์๋ํด๋ด์ผ์ง๐
Codepen์์ ๋ณธ ๋ฒํผ์ ์ฐธ๊ณ ํด์ ๋ง๋ค์๋ค.
https://codepen.io/Wyper/pen/rNjrxrG
์ฝ๋ํ ์ฝ๋๋ฅผ ๋ณด๋ฉด์ ์ดํด๊ฐ ์๋๋ ์ฝ๋๋ค์ ๊ณต์ฑ
์ ์ ๋ฆฌํ๋ค.
์ญ์ ํ์๋ณด๋ค๋ ์์ผ๋ก ์ฐ๋๊ฒ ํจ์ฌ ํธํ๋ค.
๊ทธ๋์ ์์ดํจ๋๊ฐ ์ข ์ฌ๊ณ ์ถ๋ค... ๊ทผ๋ฐ ๋๋ฌด ๋น์ธ๋ค.๐ข
: ์น ๋ฌธ์๊ตฌ์กฐ์์ ๊ฐ์ฅ ์์์์๋ฅผ ์ ํํ๋ค.
HTML์์์ root๋ ํญ์ html์ด๋ค.
/*root ๋ด๋ถ์ ๋ณ์๋ฅผ ์ ์ธํจ*/
:root {
--maincolor: #86a8e7;
--darkcolor: #7f7fd5;
--brightcolor: #f7f7f7;
}
: ์์ ๊ณ์ฐ ๊ฒฐ๊ณผ๋ฅผ ์์ฑ๊ฐ์ผ๋ก ์ฌ์ฉํ๊ฒ ํด์ฃผ๋ ํจ,
์ฌ์น์ฐ์ฐ์ ์ฌ์ฉ
:root {
--Shift: 6px;
--Blur: 15px;
}
box-shadow: calc(var(--Shift) * -1) 0 var(--Blur) rgba(255 255 255 / 1);
: focus์๋ ๋ฌ๋ฆฌ ํค๋ณด๋๋ฅผ ์ฌ์ฉํ์ฌ ํฌ์ปค์ค ํ ๋๋ง ์ ์ฉ๋,
(for. ์คํฌ๋ฆฐ๋ฆฌ๋)
: ํ๋ฆผ, ์์ ๋ณํ ๋ฑ์ ๊ทธ๋ํฝ ํจ๊ณผ ์ ์ฉ
none : no effects (Default)
blur(px) : blur effect, larger value will create more blur.
brightness(%)
contrast(%)
drop-shadow
( h-shadow(px), v-shadow(px), blur(px), spread(px), color )
grayscale(%) : 0% ~ 100% (Default ~ completely gray)
hue-rotate(deg) : 0deg ~ 360deg (0 is default)
invert(%) : ์์๋ฐ์ , 0% ~ 100%,
Negative values are not allowed
opacity(%) : 0% ~ 100%(1),
(completely transparent ~ Default, original img)
saturate(%) : 0% ~ over 100%
sepia(%) : 0% ~ 100% (Default ~ completely sepia),
Negative values are not allowed
url() : XML, SVG
intial : Inherits from parent
inherit : default value
โจ์ฐธ๊ณ
https://www.w3schools.com/cssref/playit.asp?filename=playcss_filter&preval=saturate(8)
โจ Github: https://minbok-1998.github.io/Wave-button/
โจ Codepen: https://codepen.io/minbok-1998/pen/PoKgoKW
โจ Instagram: https://www.instagram.com/tv/CWgt7DsAd2L/?utm_source=ig_web_copy_link
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wave Button</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Sriracha&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../reset.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<button class="btn"></button>
<div class="wave_wrap">
<div class="wave"></div>
<div class="wave"></div>
<div class="wave"></div>
</div>
</div>
</body>
</html>
*,
*::before,
*::after {
box-sizing: border-box;
}
:root {
--shadowShift: 6px;
--shadowBlur: 15px;
--circleColor: rgb(241, 243, 246);
}
body {
position: relative;
min-height: 100vh;
display: flex;
justify-content: space-around;
align-items: center;
background-image: linear-gradient(to right, #fafafa 0%, #d8d8d8 100%);
}
.wave {
position: relative;
width: 500px;
height: 500px;
display: flex;
justify-content: center;
align-items: center;
}
.wave__btn {
z-index: 100;
width: 80px;
height: 80px;
border-radius: 20px;
border: none;
background-color: var(--circleColor);
transform: rotate(45deg);
transition: transform 0.2s ease-out;
box-shadow: var(--shadowShift) 0 var(--shadowBlur) rgba(55 84 170 / 0.2),
calc(var(--shadowShift) * -1) 0 var(--shadowBlur) rgba(255 255 255 / 1);
/* box-shadow: inset var(--shadowShift) 0 var(--shadowBlur) rgba(55 84 170 / 0.2),
var(--shadowShift) 0 var(--shadowBlur) rgba(55 84 170 / 0.2),
inset calc(var(--shadowShift) * -1) 0 var(--shadowBlur)
rgba(255 255 255 / 1),
calc(var(--shadowShift) * -1) 0 var(--shadowBlur) rgba(255 255 255 / 1); */
}
.wave__btn:hover {
cursor: pointer;
transform: rotate(45deg) scale(1.1);
}
.wave__btn::before {
content: "CLICK";
color: #31373f;
font-weight: bold;
font-size: 12px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
margin: auto;
transform: rotate(-45deg);
}
.wave__btn:focus {
outline: none;
}
.wave__btn:focus-visible {
border-color: #89aedf;
}
.wave__btn:active {
opacity: 0.7;
transform: rotate(45deg) scale(1);
}
.wave__container {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.wave__circle {
position: absolute;
background-color: transparent;
border: 10px solid var(--circleColor);
border-radius: 50%;
box-shadow: inset var(--shadowShift) var(--shadowShift) var(--shadowBlur) rgba(55 84 170 / 0.2),
var(--shadowShift) var(--shadowShift) var(--shadowBlur) rgba(55 84 170 / 0.2),
inset calc(var(--shadowShift) * -1) calc(var(--shadowShift) * -1) var(--shadowBlur) rgba(255 255 255 / 1),
calc(var(--shadowShift) * -1) calc(var(--shadowShift) * -1) var(--shadowBlur) rgba(255 255 255 / 1);
filter: blur(3px);
animation-name: ripple;
animation-duration: 3s;
animation-timing-function: cubic-bezier(0, 0.2, 0.8, 1);
animation-iteration-count: infinite;
}
.wave__container .wave__circle:nth-child(2) {
animation-delay: -1s;
}
.wave__container .wave__circle:nth-child(3) {
animation-delay: -2s;
}
@keyframes ripple {
0% {
top: 250px;
left: 250px;
width: 0;
height: 0;
opacity: 1;
}
100% {
top: 0;
left: 0;
width: 500px;
height: 500px;
opacity: 0;
}
}
ํ ๋ฒํผ ๋๋ฌด ์๋ป์,, ๋ด์ ๊ผญ ๋ฐ๋ผ ๋ง๋ค์ด๋ด์ผ๊ฒ ์ด์