/* Keyword values */
mix-blend-mode: normal;
mix-blend-mode: multiply;
mix-blend-mode: screen;
mix-blend-mode: overlay;
mix-blend-mode: darken;
mix-blend-mode: lighten;
mix-blend-mode: color-dodge;
mix-blend-mode: color-burn;
mix-blend-mode: hard-light;
mix-blend-mode: soft-light;
mix-blend-mode: difference;
mix-blend-mode: exclusion;
mix-blend-mode: hue;
mix-blend-mode: saturation;
mix-blend-mode: color;
mix-blend-mode: luminosity;
/* Global values */
mix-blend-mode: inherit;
mix-blend-mode: initial;
mix-blend-mode: revert;
mix-blend-mode: revert-layer;
mix-blend-mode: unset;
동그라미가 마우스를 따라다니고 버튼위에 마우스가 올라가면 동그라미가 자연스럽게 작아지는 예제
<div class="cursorItem">
<span class="circle"></span>
</div>
<div class="gate-box">
<div class="top">
<p>마스크를 쓰고 있나요?</p>
</div>
<div class="bottom">
<div class="inner">
<a href="/#yes" id="yes">네</a>
<a href="/#no" id="no">아니요</a>
</div>
</div>
</div>
body {
background-color: #4197c9;
overflow: hidden;
}
.cursorItem {
position: absolute;
top: 0;
left: 0;
z-index: 9;
pointer-events: none;
mix-blend-mode: multiply;
opacity: .5;
}
.cursorItem .circle {
position: fixed;
display: block;
width: 120px;
height: 120px;
margin: -60px 0 0 -60px;
background: #a300a8;
border-radius: 50%;
transition: all .2s ease-in-out;
}
.gate-box {
position: absolute;
top: 40%;
left: calc(50% - 200px);
width: 400px;
}
.gate-box .top {
border: 2px solid #fff;
border-bottom: none;
padding: 5px;
}
.gate-box .top p {
text-align: center;
color: #fff;
font-size: 20px;
}
.gate-box .bottom {
border: 2px solid #fff;
}
.gate-box .bottom .inner{
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-rows: 1fr;
}
.gate-box .bottom a{
font-size: 20PX;
color: #fff;
width: 100%;
text-align: center;
display: inline-block;
text-decoration: none;
padding: 20px 0;
transition: all .3s ease;
box-sizing: inherit;
}
.gate-box .bottom a:hover{
background: #fff;
color: #4197c9;
}
.gate-box .bottom #yes{
border-right: 2px solid #fff;
}
let btn_yes;
let btn_no;
let cursorItem;
let circle;
let x = 0, y = 0;
let mx = 0, my = 0;
window.onload = function () {
btn_yes = document.querySelector("#yes");
btn_no = document.querySelector("#no");
cursorItem = document.querySelector(".cursorItem");
circle = cursorItem.querySelector(".circle");
// 네 버튼 이벤트
btn_yes.addEventListener("mouseover", function (e) {
circle.style.transform = "scale(.3)";
})
btn_yes.addEventListener("mouseout", function (e) {
circle.style.transform = "scale(1)";
})
// 아니오 버튼 이벤트
btn_no.addEventListener("mouseover", function (e) {
circle.style.transform = "scale(.3)";
})
btn_no.addEventListener("mouseout", function (e) {
circle.style.transform = "scale(1)";
})
// mousemove 이벤트
window.addEventListener("mousemove", function (e) {
x = e.clientX;
y = e.clientY;
cursorItem.style.transform = "translate(" + x + "px, " + y + "px )";
});
loop();
}
function loop() {
mx += (x - mx) * .90;
my += (y - my) * .90;
cursorItem.style.transform = "translate(" + mx + "px, " + my + "px )";
requestAnimationFrame(loop);
}