Skip to content

Commit

Permalink
smooth transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
NevroHelios committed Oct 15, 2023
1 parent 0c8df56 commit f8ada5d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ window.onmousedown = (e) => {
track.dataset.mouseDownAt = e.clientX;
};

const image = document.querySelector('.image');

image.addEventListener('mouseenter', () => {
image.classList.remove('desaturated');
});

image.addEventListener('mouseleave', () => {
image.classList.add('desaturated');
});


window.onmousemove = (e) => {
if (track.dataset.mouseDownAt === "0") return;

Expand Down
7 changes: 7 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
src: url('pixeboy.ttf');
}

.image {
transition: filter 0.3s ease-in-out;
}
.image.desaturated {
filter: grayscale(100%);
}

body {
min-height: 100vh;
background-color: rgb(36, 33, 33);
Expand Down

0 comments on commit f8ada5d

Please sign in to comment.