Is there a way to achieve a text filling effect on page scroll similar to the one found here: . The specific section reads: "Deepen customer relationships. Own the brand experience. Add high margin revenue. Manage it all in one place. Get back your precious time."
I attempted it myself here: https://codepen.io/sejalshah/pen/rNrdPmm
$(window).scroll(function () {
var scrolled_val = window.scrollY;
console.log( 'scroll pos: '+ scrolled_val );
progress();
});
function progress() {
var animation_elements = $('.progress-text_word');
const delay = 2000;
$(".progress-text_word").css('opacity','0.4').each(function(i) {
//$(this).delay(i*1500).fadeIn(1500);
$(this).delay(i*200).queue(function (next) {
$(this).css('opacity', '1');
next();
});
})
$(this).off('scroll');
}
body{
background: #000;
color: #fff;
overflow: auto;
}
.gradient-text {
position: relative;
width: 55vw;
font-size: 40px;
color: #f6f6f4;
margin: auto;
line-height: 1.5;
padding: 20px;
//color: transparent;
background: -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(25%, transparent), color-stop(#F8A17B), color-stop(#FDE9E7), color-stop(75%, transparent), to(transparent));
background: linear-gradient(transparent, transparent 25%, #F8A17B, #FDE9E7, transparent 75%, transparent);
-webkit-background-clip: text;
background-clip: text;
background-size: 100% 500%;
background-position: center 0;
}
.progress-text_word {
opacity: 0.4;
transition: .6s opacity cubic-bezier(0.19,1,0.22,1);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="gradient-text progress-text_text">
<span class="progress-text_word" >Inside</span>
<span class="progress-text_word" >our</span>
<span class="progress-text_word" >homes</span>
<span class="progress-text_word" >live</span>
<span class="progress-text_word" >millions</span>
<span class="progress-text_word" >of</span>
<span class="progress-text_word" >invisible</span>
<span class="progress-text_word" >pollutants</span>
<span class="progress-text_word" >generated</span>
<span class="progress-text_word" >by</span>
<span class="progress-text_word" >everyday</span>
<span class="progress-text_word" >moments.</span>
<span class="progress-text_word" >homes</span>
<span class="progress-text_word" >live</span>
<span class="progress-text_word" >millions</span>
<span class="progress-text_word" >of</span>
<span class="progress-text_word" >invisible</span>
<span class="progress-text_word" >pollutants</span>
<span class="progress-text_word" >generated</span>
<span class="progress-text_word" >by</span>
<span class="progress-text_word" >everyday</span>
<span class="progress-text_word" >moments.</span>
<span class="progress-text_word" >homes</span>
<span class="progress-text_word" >live</span>
<span class="progress-text_word" >millions</span>
<span class="progress-text_word" >of</span>
<span class="progress-text_word" >invisible</span>
<span class="progress-text_word" >pollutants</span>
<span class="progress-text_word" >generated</span>
<span class="progress-text_word" >by</span>
<span class="progress-text_word" >everyday</span>
<span class="progress-text_word" >moments.</span>
<span class="progress-text_word" >homes</span>
<span class="progress-text_word" >live</span>
<span class="progress-text_word" >millions</span>
<span class="progress-text_word" >of</span>
<span class="progress-text_word" >invisible</span>
<span class="progress-text_word" >pollutants</span>
<span class="progress-text_word" >generated</span>
<span class="progress-text_word" >by</span>
<span class="progress-text_word" >everyday</span>
<span class="progress-text_word" >moments.</span>
<span class="progress-text_word" >homes</span>
<span class="progress-text_word" >live</span>
<span class="progress-text_word" >millions</span>
<span class="progress-text_word" >of</span>
<span class="progress-text_word" >invisible</span>
<span class="progress-text_word" >pollutants</span>
<span class="progress-text_word" >generated</span>
<span class="progress-text_word" >by</span>
<span class="progress-text_word" >everyday</span>
<span class="progress-text_word" >moments.</span>
...
</div>
Unfortunately, I'm unable to fill in the text sequentially as the user scrolls down. I suspect that there might be a JavaScript library or solution available to accomplish this. Can anyone provide assistance?