Vanilla javaScript: Text Reveal Effect On Scroll

Поділитися
Вставка
  • Опубліковано 15 кві 2023
  • Hi Guys,
    Back with another video where we will be creating a text reveal on scroll effect using vanilla javascript seen in many modern websites.
    Many thanks for watching.
    Conor
  • Наука та технологія

КОМЕНТАРІ • 24

  • @deepak8586
    @deepak8586 Рік тому +1

    I have been looking for this all over youtube thanks for sharing!!

  • @kelligart4847
    @kelligart4847 Рік тому

    Another great tutorial, thanks Conor !

  • @aleksejsskurjats6394
    @aleksejsskurjats6394 Рік тому +2

    Thanks man for sharing your knowledge! 🚀💥

  • @truowng7065
    @truowng7065 Рік тому

    Thanks for sharing ❤

  • @Babbili
    @Babbili Рік тому

    so nice

  • @user-zw7ux5gl9q
    @user-zw7ux5gl9q 9 місяців тому +2

    Thank you so much for this tutorial, such a great animation. But I'm having trouble because it slows my website a lot, it seems like lagging when reach the point with the animated paragraph. Do you have any suggestions to make it lighter?
    EDIT: I solved the problem by splitting paragraphs by words and not by a single character. Much lighter!
    To do that just change
    → let pArray = paragraph.textContent.split('');
    to this
    → let pArray = paragraph.textContent.split(' ');
    And I added padding-right to span style, to simulate blank spaces between words.
    Hope this will be useful to someone stuck in the same situation I was.

  • @tomsgxdv2528
    @tomsgxdv2528 Рік тому

    thank you for this great work!
    Can you help me, I'm having trouble changing the opacity of the text lower in the screen (top position about 50%) because it causes reading problems. (I don't know what values to change)
    THANK YOU

  • @howuseehim
    @howuseehim Рік тому +1

    What is your theme ? Thanks for the tuts very useful stuff as usual

    • @ConorBailey
      @ConorBailey  Рік тому

      Thanks! its GitHub Dark theme in VS Code..

  • @guru-xn9yp
    @guru-xn9yp Рік тому +1

    thanks a lot man! what's that vscode theme btw?

    • @ConorBailey
      @ConorBailey  Рік тому

      Thanks. Its GitHub Dark theme

    • @guru-xn9yp
      @guru-xn9yp Рік тому +1

      @@ConorBailey much appriciated, keep your awsome tuts coming 🙏

  • @ggwp185
    @ggwp185 5 місяців тому

    So u can now do this only using CSS.
    Use animation timeline view

    • @ConorBailey
      @ConorBailey  5 місяців тому

      Nice! Will look into this!

  • @BMikel
    @BMikel Рік тому

    what about mobile devices? does it work on mobile?

    • @ConorBailey
      @ConorBailey  Рік тому +1

      Hi. Yes I’ve tested this on mobile and it works great!

  • @hail816
    @hail816 Рік тому

    Can you create a tutorial on webgl image hover effects without using plugins?

  • @bewise2023
    @bewise2023 Рік тому

    is there any code link
    my this code is not working

    • @bewise2023
      @bewise2023 Рік тому

      let paragraphs = [...document.querySelectorAll('p')]
      let spans = [];
      paragraphs.forEach(paragraph => {
      let htmlString = '';
      let pArray = paragraph.textContent.split('')
      for(let i = 0;i 1 ? 1 : opacityValue.toFixed(3);
      spans[i].style.opacity = opacityValue;
      }
      }
      }
      window.addEventListener('scroll', () => {
      revealSpans();
      })
      revealSpans();

    • @ConorBailey
      @ConorBailey  Рік тому

      I can post it later. What error are you receiving? I can try to help.

    • @evanmatthews4097
      @evanmatthews4097 Рік тому +1

      @@ConorBailey Drop us the code, bro!

    • @dcampagne1
      @dcampagne1 Рік тому

      @@ConorBailey post it! don't be shy

    • @dcampagne1
      @dcampagne1 Рік тому +5

      @@evanmatthews4097 let paragraphs = [...document.querySelectorAll('p')];
      let spans = [];
      paragraphs.forEach(paragraph => {
      let htmlString = '';
      let pArray = paragraph.textContent.split('');
      for (let i = 0; i < pArray.length; i++) {
      htmlString += `${pArray[i]}`;
      }
      paragraph.innerHTML = htmlString;
      });
      spans = [...document.querySelectorAll('span')];
      function revealSpans() {
      for (let i = 0; i < spans.length; i++) {
      if (spans[i].parentElement.getBoundingClientRect().top < window.innerHeight / 2) {
      let { left, top } = spans[i].getBoundingClientRect();
      top = top - (window.innerHeight * 0.2);
      let opacityValue = 1 - ((top * 0.01) + (left * 0.001));
      opacityValue = opacityValue < 0.1 ? 0.1 : opacityValue > 1 ? 1 : opacityValue.toFixed(3);
      spans[i].style.opacity = opacityValue;
      }
      }
      }
      window.addEventListener('scroll', revealSpans);
      revealSpans();