Browse Source

Make news scroll past more smoothly

tags/v0.1.0
Fen Dweller 5 years ago
parent
commit
1121060fe2
No known key found for this signature in database GPG Key ID: E80B35A6F11C3656
2 changed files with 24 additions and 9 deletions
  1. +15
    -6
      gorge.css
  2. +9
    -3
      gorge.js

+ 15
- 6
gorge.css View File

@@ -582,24 +582,33 @@ div::-webkit-scrollbar-corner {
top: 15vh; top: 15vh;
left: 50vw; left: 50vw;
transform-origin: 0% 0%; transform-origin: 0% 0%;
animation: news-text-frames 7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
animation: news-text-enter 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
animation-fill-mode: both; animation-fill-mode: both;
max-width: 40vw; max-width: 40vw;
font-size: 16pt; font-size: 16pt;
} }


@keyframes news-text-frames {
.news-text.news-text-leaving {
pointer-events: none;
animation: news-text-exit 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
animation-fill-mode: both;
}

@keyframes news-text-enter {
0% { 0% {
transform: translate(-50%, -50px); transform: translate(-50%, -50px);
opacity: 0; opacity: 0;
} }
20% {
100% {
transform: translate(-50%, 0px); transform: translate(-50%, 0px);
opacity: 1; opacity: 1;
} }
80% {
transform: translate(-50%, -0px);
opacity: 1;
}

@keyframes news-text-exit {
0% {
transform: translate(-50%, 0px);
opacity: 1
} }
100% { 100% {
transform: translate(-50%, 50px); transform: translate(-50%, 50px);


+ 9
- 3
gorge.js View File

@@ -1112,20 +1112,26 @@ function showNews(text) {
div.innerHTML = text; div.innerHTML = text;


div.classList.add("news-text"); div.classList.add("news-text");
const body = document.querySelector("body");


div.addEventListener("click", () => { div.addEventListener("click", () => {
clearTimeout(newsShowTimer); clearTimeout(newsShowTimer);
clearTimeout(newsRemoveTimer); clearTimeout(newsRemoveTimer);
body.removeChild(div);
div.classList.add("news-text-leaving");
setTimeout(() => {
body.removeChild(div);
}, 1000);
doNews(); doNews();
}); });


const body = document.querySelector("body");


body.appendChild(div); body.appendChild(div);


newsRemoveTimer = setTimeout(() => { newsRemoveTimer = setTimeout(() => {
body.removeChild(div);
div.classList.add("news-text-leaving");
setTimeout(() => {
body.removeChild(div);
}, 1000);
}, 8000); }, 8000);
} }




Loading…
Cancel
Save