html, body {
    height: 200%; /* Increase height to enable scrolling */
    margin: 0;
  }
  
  .scroll-container {
    position: relative;
    width: 100%;
    height: 100%;
  }
  
  .animate-box {
    position: absolute;
    width: 100px;
    height: 100px;
    background-color: red;
    opacity: 0; /* Start with hidden elements */
    transition: transform 1s, opacity 1s;
  }
  
  #left-to-right {
    top: 10%;
    left: -100px; /* Start off-screen to the left */
  }
  
  #right-to-left {
    top: 30%;
    left: 100vw; /* Start off-screen to the right */
  }
  
  #top-to-bottom {
    top: -100px; /* Start off-screen above */
    left: 50%;
    transform: translateX(-50%);
  }
  
  #bottom-to-top {
    top: 100vh; /* Start off-screen below */
    left: 50%;
    transform: translateX(-50%);
  }
  