Vanilla javaScript: Text Reveal Effect On Scroll

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2024
  • 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

ความคิดเห็น • 26

  • @deepak8586
    @deepak8586 ปีที่แล้ว +2

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

  • @aleksejsskurjats6394
    @aleksejsskurjats6394 ปีที่แล้ว +2

    Thanks man for sharing your knowledge! 🚀💥

  • @kelligart4847
    @kelligart4847 ปีที่แล้ว

    Another great tutorial, thanks Conor !

  • @MatteoMastrototaro-q6o
    @MatteoMastrototaro-q6o ปีที่แล้ว +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.

  • @truowng
    @truowng ปีที่แล้ว

    Thanks for sharing ❤

  • @WorshipMinistryTraining
    @WorshipMinistryTraining 3 หลายเดือนก่อน

    Can I make it one word at a time, instead of one character at a time?

  • @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..

  • @Babbili
    @Babbili ปีที่แล้ว

    so nice

  • @TonyMathew-j5p
    @TonyMathew-j5p 3 หลายเดือนก่อน

    where does span added in html

  • @ggwp185
    @ggwp185 8 หลายเดือนก่อน

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

    • @ConorBailey
      @ConorBailey  8 หลายเดือนก่อน

      Nice! Will look into this!

  • @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 🙏

  • @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();