Answer the question
In order to leave comments, you need to log in
Make text animation when scrolling through the page?
I really liked the animation of the text when scrolling the page ( surl.li/iliw ) - who can tell how this can be implemented.
It would also be interesting to know what effect on the video when scrolling.?
Answer the question
In order to leave comments, you need to log in
const animItems = document.querySelectorAll(`._anim-items`)
if (animItems.length > 0) {
window.addEventListener(`scroll`, animOnScroll)
function animOnScroll() {
for (let index = 0; index < animItems.length; index++) {
const animItem = animItems[index]
const animItemHeight = animItem.offsetHeight
const animItemOffSet = offset(animItem).top
const animStart = 4
let animItemPoint = window.innerHeight - animItemHeight / animStart
if (animItemHeight > window.innerHeight) {
animItemPoint = window.innerHeight - window.innerHeight / animStart
}
if ((pageYOffset > animItemOffSet - animItemPoint) && pageYOffset < (animItemOffSet + animItemHeight)) {
animItem.classList.add(`_active`)
} else {
if (!(animItem.classList.contains(`_anim-no-hide`))) {
animItem.classList.remove(`_active`)
}
}
}
}
function offset(el) {
const rect = el.getBoundingClientRect()
let scrollLeft = window.pageXOffset || document.documentElement.scrollLeft
let scrollTop = window.pageYOffset || document.documentElement.scrollTop
return {top: rect.top + scrollTop, left: rect.left + scrollLeft}
}
setTimeout(() => {
animOnScroll()
}, 300)
}
.header {
transform: translate(0, -80%);
opacity: 0.5;
transition: all 1s ease 0s;
}
.header._active {
transform: translate(0, 0);
opacity: 1;
}
1 in 1 I will not prompt. Obviously made by hand.
Smoke it . For text, that's it. And bg I think you'll get a taste of how to glitch
Example | Source
Most suitable A6
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question