Big jobs usually go to the men who prove their ability to outgrow small ones.
Big jobs usually go to the men who prove their ability to outgrow small ones.
마우스 이펙트 - 마우스 따라 다니기
language-html"><main>
<div class="cursor"></div>
<div class="cursor-follower"></div>
<article class="mouseCont">
<p>Big jobs <em>usually go to the men</em> who prove their ability to outgrow small ones.</p>
<h2>작은 일에서 성장할 능력이 있는 사람에게 <em>큰일이 주어</em>진다.</h2>
</article>
</main>
.mouseCont {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
color: #fff;
height: 100vh;
width: 100%;
overflow: hidden;
font-family: 'NEXONLv1Gothic';
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 orange;
color: orange;
}
.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-follower {
position: absolute;
width: 30px; height: 30px;
background: rgba(255,255,255,0.3);
border-radius: 50%;
user-select: none;
pointer-events: none;
transition: transform 0.6s ease-in-out, opacity 0.2s;
}
.cursor-follower.active {
transform: scale(5);
background: rgba(255, 166, 0, 0.5);
}
const cursor = $(".cursor");
const follower = $(".cursor-follower");
//움직임 효과
$(window).mousemove(function (e) {
gsap.to(cursor, {durtaion: 0.3, left: e.pageX -5, top: e.pageY-5})
gsap.to(follower, {durtaion: 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")
});
// 출력용
$(window).mousemove(function (e) {
$(".pageX").text(e.pageX + "px"); //페이지 X좌표 기준
$(".pageY").text(e.pageY + "px"); //페이지 Y좌표 기준
});