A negative mind never give you a positive life
A negative mind never give you a positive life
마우스 이펙트 - 브랜딩 이펙트
<!-- contents -->
<main>
<div class="cursor"></div>
<article class="mouseCont">
<p>A negative mind never give you a <em>positive life</em></p>
<h2>부정적인 마인드는 당신에게 절대로 <em>긍정적인 삶을</em> 가져다주지 않을 것이다.</h2>
</article>
</main>
<!-- //contents -->
<!-- info -->
<div class="info">
<h1><a href="index.html">Mouse Effect03 - javascript</a></h1>
<p>마우스 이펙트 - 브랜딩 이펙트</p>
</div>
<div class="info right">
<ul>
<li><a href="javascriptME01.html">1</a></li>
<li><a href="javascriptME02.html">2</a></li>
<li class="active"><a href="javascriptME03.html">3</a></li>
<li><a href="javascriptME04.html">4</a></li>
<li><a href="javascriptME05.html">5</a></li>
</ul>
<ul>
<li><a href="jqueryME01.html">1</a></li>
<li><a href="jqueryME02.html">2</a></li>
<li><a href="jqueryME03.html">3</a></li>
<li><a href="jqueryME04.html">4</a></li>
<li><a href="jqueryME05.html">5</a></li>
</ul>
</div>
<div class="info left list">
<ul>
<li>multiply</li>
<li>screen</li>
<li>overlay</li>
<li>darken</li>
<li>lighten</li>
<li>color-dodge</li>
<li>color-burn</li>
<li>hard-light</li>
<li>soft-light</li>
<li class="active">difference</li>
<li>exclusion</li>
<li>hue</li>
<li>saturation</li>
<li>color</li>
<li>luminosity</li>
</ul>
</div>
<!-- //info left -->
.mouseCont {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
color: #fff;
width: 100%;
height: 100vh;
overflow: hidden;
font-family: 'S-CoreDream';
cursor: none;
}
.mouseCont p {
font-size: 2.5vw;
line-height: 2.3;
font-weight: 300;
}
.mouseCont h2 {
font-size: 3vw;
font-weight: normal;
font-weight: 400;
}
.mouseCont em {
font-style: normal;
border-bottom: 0.2vw dashed #F4FF52;
color: #F4FF52;
}
.cursor {
position: absolute;
left: 0; top: 0;
width: 10px;
height: 10px;
border-radius: 50%;
z-index: 9999;
background-color: #F4FF52;
user-select: none;
pointer-events: none;
transition: transform 0.3s;
mix-blend-mode: difference;
}
.cursor.active {
transform: scale(20);
}
.info.left.list li.active {
text-decoration: underline;
color: #F4FF52;
}
const width = document.querySelector(".cursor").clientWidth / 2;
const height = document.querySelector(".cursor").clientHeight / 2;
// 움직임 효과
document.addEventListener("mousemove", (e) => {
gsap.to(".cursor", {duration: 0.5, left: e.pageX-width, top: e.pageY-height});
});
// 오버 효과
document.querySelectorAll(".mouseCont em").forEach((em) => {
em.addEventListener("mouseenter", () => {
document.querySelector(".cursor").classList.add("active");
});
em.addEventListener("mouseleave", () => {
document.querySelector(".cursor").classList.remove("active");
});
});
// 출력용
document.querySelectorAll(".info.left.list li").forEach((info) => {
info.addEventListener("click", function(){
document.querySelectorAll(".info.left.list li").forEach(li => {
li.classList.remove("active");
this.classList.add("active");
});
let text = info.textContent || info.innerText;
document.querySelector(".cursor").style.mixBlendMode = text;
});
})
// 소스보기 실행함수
modal();