Skip to main content

Scoll in Animation using ScrollMagic.js Plugin

    In this tutorial, we will learn how to create a scrolling text effect using the ScrollMagic.js plugin. This powerful JavaScript library allows us to easily create complex scrolling animations and interactions. We will be using the ScrollMagic.js plugin to create a scrolling text effect that can be used to add dynamic and engaging elements to your website or web application. Whether you're a beginner or an experienced developer, this tutorial will provide you with the knowledge and tools you need to create your own scrolling text effect using ScrollMagic.js.

index.html

<html>
      <head>
          <title>Fade In Text On Scrolling</title>
          <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
          <script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/ScrollMagic.min.js"></script>
          <link href="https://fonts.googleapis.com/css?family=Open+Sans|Staatliches" rel="stylesheet">
          <script src="js/scroll.js"></script>
          <link rel="stylesheet" href="css/style.css">
      </head>
      <body>
          <div class="container1">
              <h1>SCROLL DOWN</h1>
              <h2>some texts will appear</h2>
          </div>
          <div class="container2">
              <div class="fade-in">
                  <h1>LOREM IPSUM</h1>
                  <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
                  aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
                  Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
                  occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</h2>
              </div>
          </div>
      </body>

  </html>

style.css

html, body{
      margin: 0;
      width: 100%;
  }

  .container1{
      height: 800px;
      background-color: #263c63;
      text-align: center;
  }

  .container1 h1{
      font-family: 'Staatliches', cursive;
      font-size: 200px;
      letter-spacing: 0.1em;
      color: #9aeaf4;
      padding-top: 200px;
      margin: 0;
  }

  .container1 h2{
      font-size: 40px;
      font-family: 'Open Sans', sans-serif;
      margin:0;
      color: #fff;
  }

  .container2{
      height: 600px;
  }

  .fade-in{
      width: 100%;
      height: 400px;
      margin-top: 10%;
      text-align: center;
      opacity: 0;
      transform: translateY(50px);
      transition: all 1s ease-out;
  }

  .fade-in.show{
      opacity: 1;
      transform: translateY(0);
  }

  .fade-in h1{
      font-family: 'Staatliches', cursive;
      margin: 0;
      font-size: 120px;
      letter-spacing: 0.1em;
  }

  .fade-in h2{
      font-family: 'Open Sans', sans-serif;
      font-weight: lighter;
      letter-spacing: 0.1em;
      line-height: 1.5;
      width: 70%;
      font-size: 20px;
      margin-left: 15%;
  }

scroll.js

$(document).ready(function(){

      var controller = new ScrollMagic.Controller();

      var ourScene = new ScrollMagic.Scene({
          triggerElement: '.fade-in',
          reverse: false
      })
          .setClassToggle('.fade-in', 'show')
          .addTo(controller);
  });

Watch Full Video Here

Comments

Popular posts from this blog

Auto Image Slider using CSS Only

     Are you ready to learn how to create an image slider using only CSS? Look no further! In this tutorial, we'll walk you through the step-by-step process of building a sleek and modern image slider using HTML and CSS. No JavaScript required! In this tutorial We'll cover setting up the HTML structure for the slider.       This will include creating the container element and styling the slider with CSS. You'll also learn how to add transitions and animations to create a smooth sliding effect. By the end of this tutorial, you'll have a fully functional image slider that you can use on your own website. Whether you're a beginner or an experienced developer, this tutorial has something for you. So let's get started creating your own image slider using CSS today! index.html <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/style.css"...

Display Battery Status using HTML, CSS and Javascript

     Hey everyone, welcome to Code Instinct! In this tutorial, we're going to show you how to create a battery status indicator using HTML, CSS and Javascript. This is a great Javascript project for beginners who want to learn how to use the Battery API Javascript and create a battery level indicator. We'll also be showing you how to add a battery charging animation and CSS battery shape to make it more visually appealing.Our tutorial will cover all the steps needed to create your own battery status indicator with ease. You'll learn how to use the Battery API Javascript to get the current battery level of your device, and display it using HTML and CSS.       We'll also be covering the different types of battery indicators you can use and how to customize them to fit your website design. You'll learn how to create a battery charging animation using Javascript and CSS to give your battery status indicator a more dynamic look.At Code Instinct, we're dedi...

Control Your Weights using this Javascript App - Simple BMI Calculator

       Embark on a coding journey that will demystify the intricacies of web development with our comprehensive tutorial, "Creating a BMI Calculator Using JavaScript." Whether you're a novice in the realm of programming or an enthusiast seeking to augment your JavaScript skills, this step-by-step guide promises to be an illuminating experience. To kick off our journey, we'll delve into the fundamental building blocks of web development—HTML, CSS, and JavaScript. This tutorial caters to individuals ranging from absolute beginners to those looking to fortify their existing skill set. By providing a holistic understanding of these essential languages, participants can lay a solid foundation for their future endeavors in the dynamic field of web development.      As we progress through the tutorial, we'll focus extensively on JavaScript, unraveling its intricacies in a manner accessible to beginners. The comprehensive nature of this tutorial makes it an id...