We cannot become what we want by remaining what we are.
We cannot become what we want by remaining what we are.
마우스 이펙트 - 마우스 따라다니기
<!-- contents -->
<main>
<div class="cursor"></div>
<div class="cursor-follower"></div>
<article class="mouseCont">
<p>We cannot become what we <em>want</em> by remaining what we are.</p>
<h2>지금 상태 그대로 남아있는다면 우리는 우리가 <em>원하는</em> 모습이 될 수 없다.</h2>
</article>
</main>
<!-- //contents -->
<!-- info -->
<div class="info">
<h1><a href="index.html">Mouse Effect02 - jquery</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><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 class="active"><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>pageX : <span class="pageX">0</span></li>
<li>pageY : <span class="pageY">0</span></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: rgba(255,255,255,0.1);
user-select: none;
pointer-events: none;
transition: transform 0.3s, opacity 0.2s;
}
.cursor.active {
opacity: .5;
transform: scale(0);
}
.cursor.show {
opacity: .5;
transform: scale(10);
background: rgb(0, 225, 255, 0.6);
}
.cursor-follower {
position: absolute;
width: 30px;
height: 30px;
border-radius: 50%;
background: rgba(255,255,255,0.3);
user-select: none;
pointer-events: none;
transition: transform 0.6s ease-in-out, opacity 0.2s ease-in-out;
}
.cursor-follower.active {
transform: scale(5);
background: #e71d358a;
}
.cursor-follower.show {
transform: scale(5);
background: rgb(0, 225, 255, 0.6);
}
.info,
.info a {
cursor: none;
}
const cursor = $(".cursor");
const follower = $(".cursor-follower");
// 마우스 움직이기
$(window).mousemove(function(e){
// cursor.css({left: e.pageX -5, top: e.pageY -5});
// follower.css({left: e.pageX -15, top: e.pageY -15});
gsap.to(cursor, {duration: 0.3, left: e.pageX -5, top: e.pageY -5});
gsap.to(follower, {duration: 0.8, left: e.pageX -15, top: e.pageY -15});
});
// 오버 효과
$(".mouseCont em").hover(function(){
cursor.addClass("active");
follower.addClass("active");
}, function(){
cursor.removeClass("active");
follower.removeClass("active");
});
// 오버 효과2
$(".info").hover(function(){
cursor.addClass("show");
follower.addClass("show");
}, function(){
cursor.removeClass("show");
follower.removeClass("show");
});
// 출력용
$(window).mousemove(function(e){
$(".pageX").text(e.pageX + "px"); //페이지 X좌표 기준
$(".pageY").text(e.pageY + "px"); //페이지 Y좌표 기준
});
// 소스보기 실행함수
modal();