728x90
반응형
마우스 이펙트01
마우스의 위치값 표시 , 특정 글자에 갖대 대면 애니메이션? 이 나온다.
HTML
<section id="mouseType">
<div class="mouse__cursor"></div>
<div class="mouse__wrap">
<p>The <span class="style1">future</span> <span class="style2">depends</span> on What we
do in the<span class="style3"> present.</span>
</p>
<p><span class="style4">미래</span>는 현재 <span class="style5">우리가</span> 무엇을 <span
class="style6">하는가에</span> 달려있다.</p>
</div>
</section>
CSS
/* mouseType */
.mouse__wrap {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
overflow: hidden;
flex-direction: column;
cursor: none;
}
.mouse__wrap p {
font-size: 2vw;
line-height: 2;
font-weight: 300;
}
.mouse__wrap p:last-child {
font-size: 3vw;
font-weight: 300;
}
.mouse__wrap p span {
border-bottom: 0.15vw dashed orange;
color: orange;
}
@media (max-width: 800px) {
.mouse__wrap p {
padding: 0 20px;
font-size: 24px;
line-height: 1.5;
text-align: center;
margin-bottom: 10px;
}
.mouse__wrap p:last-child {
font-size: 40px;
line-height: 1.5;
text-align: center;
word-break: keep-all;
}
}
/* 커서 */
.mouse__cursor {
position: absolute;
left: 0;
top: 0;
width: 50px;
height: 50px;
border-radius: 50%;
border: 3px solid #fff;
background-color: rgba(255, 255, 255, 0.1);
user-select: none;
pointer-events: none;
transition:
background-color 0.3s,
border-color 0.3s,
transform 0.6,
border-radius 0.3s;
}
.mouse__cursor.style1 {
background-color: rgba(255, 165, 0, 0.4);
border-color: orange;
}
.mouse__cursor.style2 {
background-color: rgba(140, 0, 255, 0.4);
border-color: rgb(140, 0, 255);
transform: scale(2) rotateY(720deg);
}
.mouse__cursor.style3 {
background-color: rgb(0, 47, 255, 0.4);
border-color: rgb(0, 47, 255);
transform: scale(1.5) rotateX(45deg);
}
.mouse__cursor.style4 {
background-color: rgb(0., 47, 255, 0.4);
border-color: rgb(0, 47, 255);
transform: scale(10);
}
.mouse__cursor.style5 {
background-color: rgb(255, 0, 85, 0.4);
border-color: rgb(255, 0, 85);
transform: scale(0.1);
}
.mouse__cursor.style6 {
background-color: rgb(255, 81, 0, 0.4);
border-color: rgb(255, 81, 0);
border-radius: 0;
transform: scale(5);
}
.mouse__info {
position: absolute;
left: 20px;
bottom: 10px;
font-size: 14px;
line-height: 1.6;
color: #fff;
}
//getAttribute()
document.querySelectorAll(".mouse__wrap span").forEach(span => {
let attr = span.getAttribute("class");
span.addEventListener("mouseover", () => {
cursor.classList.add(attr);
});
span.addEventListener("mouseout", () => {
cursor.classList.remove(attr);
})
});
728x90
'Effect > mouse' 카테고리의 다른 글
마우스 이펙트 05 (1) | 2022.09.28 |
---|---|
마우스 이펙트 04 (4) | 2022.09.22 |
마우스 이펙트 03 (2) | 2022.09.22 |
마우스 이펙트 02 (2) | 2022.09.19 |
댓글