Guide on making a Star Wars inspired rolling credits effect

I am having an issue with a CSS animation that mimics the Star Wars credits. The problem I'm facing is that the animation cuts off before all the text has scrolled.

Why is it that I can't display all the text content I want within the animation?

The speed of the animation only seems to control the scroll speed, and I haven't been able to figure out how @keyframes could handle this specific issue.

Despite my text being longer than the original content and containing additional paragraphs, I fail to comprehend why this affects the animation's behavior. In theory, shouldn't the animation be endless regardless of the text length?

body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  background: #000 url(https://cssanimation.rocks/demo/starwars/images/bg.jpg);
}

.fade {
  position: relative;
  width: 100%;
  min-height: 60vh;
  top: -25px;
  background-image: linear-gradient(0deg, transparent, black 75%);
  z-index: 1;
}

.star-wars {
  display: flex;
  justify-content: center;
  position: relative;
  height: 800px;
  color: #feda4a;
  font-family: 'Pathway Gothic One', sans-serif;
  font-size: 500%;
  font-weight: 600;
  letter-spacing: 6px;
  line-height: 150%;
  perspective: 400px;
  text-align: justify;
}

.crawl {
  position: relative;
  top: 99999px;
  transform-origin: 50% 100%;
  animation: crawl 60s linear infinite;
  /* velocidad del texto */
}

.crawl>.title {
  font-size: 90%;
  text-align: center;
}

.crawl>.title h1 {
  margin: 0 0 100px;
  text-transform: uppercase;
}

@keyframes crawl {
  0% {
    top: -100px;
    transform: rotateX(20deg) translateZ(0);
  }
  100% {
    top: -6000px;
    transform: rotateX(25deg) translateZ(-2500px);
  }
}
<div class="fade"></div>

<section class="star-wars">
  <div class="crawl">
    <div class="title">


      <p>Episode XIII</p>
      <h1>THE ADVAITIC JEDIS</h1>
    </div>

    <p>On planet Earth, an unknown virus terrifies the population. The hordes of the conspiracy empire confine people in their homes, completely terrified.</p>

    <p>It was then the perfect moment for a command from the interstellar confederation led by a Dutch Sith to decide to kidnap Fernando Cain. They wanted to make him pay for his insolent disrespect.</p>

    <p>Fernando Cain did not resist. "The movie E.T has more metaphysics than you..." he said, provoking them.
    </p>

    <p>His loyal Advaitic Jedi friend, FRAN SOLO, decides to go on his rescue mission... ...again. He already saved him from a fight in a bar with some drunk Greys when he messed with them. "You have to be idiots... ...being experts in genetic engineering and forgetting
      to hybridize a decent penis.." </p>
    <p>FRAN SOLO retrieves his ship hidden deep in Gran Canaria and this time, due to the danger of the mission, he decides not to go alone on this rescue adventure. He decides to find the other Advaitic Jedis located at the far ends of the universe transmitting
      their knowledge.</p>
    <p>JUAN QUENOVI was teaching reiki to porn actresses on the planet Xumino as usual. Commander ALEC CHEWBACCA was having intercourse with twelve interstellar valkyries when he heard the news. "After about 100 more interstellar couplings, I'll join the
      adventure." he said. </p>
    <p>FRAN sent several interstellar telemessages. One to PABLO PADAWAN who was as always engaged in interstellar diplomacy. This time explaining to the Hummits that smoked pork wasn't a provocation by the humans against their race
      </p>
    <p>Meanwhile, SERGIO REN was teaching Saturnian Astrology at the University of Titan to fifth-dimensional beings. They couldn’t figure out how many universes they had simultaneously born into. </p>
    <p>ALBERTO ORGANA and ANIBAL DAMERON were studying Pleiadian shamanism on planet XJX-232, uncertain of their involvement. </p>
    <p>"We can do it without really doing it, impersonally, if we save him, we save him, and if not, nothing happens, whatever will happen will happen, and if not something else will happen," exclaimed the great FRAN SOLO in a profound message. </p>
    <p>Convinced, they embarked on an exciting and dangerous adventure. The Advaitic Jedis were together and no one in the world could stop them...</p>
    <p>...well... ..perhaps they needed to find a sweet toroid from SERGIO REN for the journey...</p>
  </div>
</section>

Answer №1

It seems like you're making the logic more complex than it needs to be by using translateZ() and top. You can simplify things by utilizing rotation and translateY instead.

I've made some updates to the code to ensure that the text displays correctly based on percentage values.

For optimal results, run the snippet in full page mode

html {
  background: #000;
  overflow: hidden;
  background: #000 url(https://cssanimation.rocks/demo/starwars/images/bg.jpg);
}
html::before {
  content:"";
  position:fixed;
  left:0;
  right:0;
  top:0;
  min-height: 60vh;
  background-image: linear-gradient(0deg, transparent, black 75%);
  z-index: 1;
}

.star-wars {
  display: flex;
  flex-direction:column;
  justify-content: flex-end;
  align-items:center;
  height: 100vh;
  color: #feda4a;
  font-family: 'Pathway Gothic One', sans-serif;
  font-size: 500%;
  font-weight: 600;
  letter-spacing: 6px;
  line-height: 150%;
  perspective: 100px;
  text-align: justify;
}

.crawl {
  transform-origin: bottom;
  width:90%;
  animation: crawl 80s linear forwards; /* speed of text crawl */
}

.crawl>.title {
  font-size: 90%;
  text-align: center;
}

.crawl>.title h1 {
  margin: 0 0 100px;
  text-transform: uppercase;
}

@keyframes crawl {
  0% {
    transform:rotateX(20deg) translateY(100%);
  }
  100% {
    transform:rotateX(25deg) translateY(-100%);
    /* OR
    transform:rotateX(25deg) translateY(0%);
    if you want the text to stop at the bottom
    */
  }
}
<section class="star-wars">
  <div class="crawl">
    <div class="title">


      <p>Episode XIII</p>
      <h1>THE ADVAITIC JEDIS</h1>
    </div>

    <p>On planet Earth, an unknown virus threatens the population. The conspiratorial empire's hordes confine people to their homes in total fear.</p>

    <p>It was the perfect moment for a commando from the interstellar confederation led by a Dutch Sith to decide to kidnap Fernando Cain. They wanted him to pay for his insolent lack of respect.</p>

    <p>Fernando Cain did not resist. "The movie E.T has more metaphysics than all of you ..." he said provocatively.
    </p>

    <p>His loyal Advaitic Jedi friend, FRAN SOLO, decides to go to his rescue... ... once again. He already saved him from a fight in a bar with some drunk grays when they picked a fight. "You have to be idiots... ...being experts in genetic engineering
      and forgetting to hybridize a properly functioning penis..."</p>
    <p> FRAN SOLO retrieved his ship hidden deep in Gran Canaria and this time, due to the danger of the mission, decided not to go alone on this rescue adventure. He decided to seek out the other Advaitic Jedis who were located in the far reaches of the universe
      transmitting their knowledge.</p>
    <p>JUAN QUENOVI was teaching reiki to porn actresses on the planet Xumino as usual. Commander ALEC CHEWBACCA was having sex with twelve interstellar valkyries when he heard the news. "I'll finish about a hundred interstellar screws and then I'll join the
      adventure." he said.</p>
    <p>FRAN sent several interstellar tele-messages. One to PABLO PADAWAN who was as usual engaged in interstellar diplomacy efforts. This time he was explaining to the Hummitas that smoked pork was not a provocation by humans against their race.</p>
    <p>Meanwhile, SERGIO REN was teaching Saturnian Astrology at the Titan University to fifth-dimensional beings. They couldn't figure out how many universes they had been born into simultaneously.</p>
    <p>ALBERTO ORGANA and ANIBAL DAMERON were studying Pleiadian shamanism on planet XJX-232, unsure of their involvement.</p>
    <p>"We can do it without doing it, impersonally, save him, save him, and if not, nothing happens, whatever is meant to happen will happen, and if not, nothing else will happen," said the great FRAN solo in a profound message.</p>
    <p>Convinced, they embarked on a thrilling and dangerous adventure. The Advaitic Jedis were united and no one in the world could stop them...</p>
    <p>...well... ..maybe they would need to find some sweet toroids from SERGIO REN for the journey...</p>
  </div>
</section>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Change the color of the image to black and white and then back to its original state when a specific element is hovered over

Searching for a jQuery plugin to convert an image to black and white? Look no further! I've explored various options, but none quite fit the bill. What I'm really after is an effect that will revert the image back to color when a specific element ...

The z-index of the fixed header in FullPageJS is causing the section's content to be hidden

For my current project, I am incorporating FullPageJS and using a fixed top menu that adjusts its height based on the viewport size. On smaller screens, the menu items will be stacked on top of each other, while on wider screens, the menu items will be po ...

Floating elements are misaligned and not laying out correctly

I've encountered an issue where the footer div is appearing behind the right-hand side div. I have a central container div with two floated divs next to each other, and the footer is separate. I've spent hours trying to fix it but can't figu ...

Modifying the appearance of Bootstrap button colors

I recently came across this code on the Bootstrap website. I am curious about how to change the text color from blue to black in this specific code snippet. Currently, the text is appearing as blue by default. For reference and a live example, you can vis ...

Is there a way to activate a click event when I click on a button that is located outside of the dialog element?

In my Vue 3 app, I am using the native HTML dialog element as a modal. I have managed to position a button outside of the modal with absolute positioning. However, I am facing an issue where I cannot trigger a click event (displayNextModal) when clicking ...

Creating a versatile table design using flexbox

Looking to create a gallery for images and videos using flexbox properties to create a dynamic table of divs to hold media. The challenge is generating the table automatically without specifying the number of rows and columns needed. For example, if I ha ...

When hovering over slick text, it becomes hidden because of non-responsive CSS. Are there any solutions to make it responsive?

I can't seem to get the on-hover dates to appear, even though they are rendered when inspecting the page. I suspect it could be related to a responsive CSS issue or class breaking. How can I resolve this? https://i.stack.imgur.com/jyEJb.png https:// ...

Need to swiftly modify values of css attributes?

Here is a snippet of the code I am working with: <div></div> <button> Go </button> div { width: 50px; height: 50px; border: 1px solid #ccc; } var bgs = ['red', 'blue', 'yellow', 'green&apo ...

Dynamic mouse parallax effect enhances the experience of a full-screen responsive background

I am looking to create a background that covers the entire viewport, similar to the example shown here: https://css-tricks.com/perfect-full-page-background-image/ Additionally, I want to have 5 images stacked on top of each other (essentially 5 layers of ...

Struggling to achieve a horizontal scroll using 'overflowX' in MUI, but unfortunately, it's not functioning as expected

Is there a way to create a properly-sized card with a horizontal scrollbar in a paper format? I've tried using 'overflow' but it doesn't seem to be working in this scenario. import React from 'react'; import { makeStyles } fro ...

What is the ideal framerate for smooth animation?

I'm looking to add a snow animation using JavaScript. I currently have it running at 200ms which is decent but not smooth enough. Would changing the interval to 20ms make it more fluid, or would it be inefficient and strain the CPU? window.setInterva ...

Increasing the width of a line to fill the entire space using CSS properties

Seeking alternative ideas to replace my current solution using only CSS for one of the problems. I already have a working JS solution, but I'm interested in exploring a CSS-only approach. https://i.sstatic.net/PQ7er.png A) All elements here have the ...

HTML is not connecting to CSS

I'm having trouble linking my external CSS to my HTML file. In the head of my index.html, I have this code: <head> <title>Twenty by HTML5 UP</title> <meta charset="utf-8" /> <meta name="viewport ...

Unraveling the mystery behind table cells failing to wrap their content when set to 100% height

Original inquiry (REVISED) CSS: Why does a table-cell sibling with a height of 100% exceed the body of the table-row? Experimenting with CSS tables, I am striving to achieve an evenly spaced column layout. I aim to have an "aside" on the left side th ...

PHP mistakenly outputs content that is not enclosed within tags

After discovering StackOverflow, I couldn't resist sharing my PHP code conundrum with the incredible community here! So, in a WordPress template, I have this chunk of PHP: echo '<div class="thumbnail">'; echo the_post_thumbnail(); ec ...

Troubleshooting the challenges with jQuery's next().addClass() and prev().addClass() functions

I am attempting to create a slider feature. I have four different contents that I've positioned consecutively, but made them invisible initially. I defined a class called active-client with the attribute display: flex. Using jQuery's addClass() m ...

Is there a way to remove the excess white space beneath my content without resorting to using overflow-y: hidden?

I am struggling to eliminate the excess white space below the body of my web page in order to make it fit perfectly within the view of a web browser. Adding height helps with vertical alignment but leaves unwanted white space. I need a solution that doesn ...

The height of the div element is causing issues for the adjacent item in the row

I am facing a styling issue where the height of my avatar image is affecting other inline items located next to it. The images below demonstrate this problem. https://i.sstatic.net/bovge.png https://i.sstatic.net/EsF2R.png As you can see, when I increas ...

Preventing div contents from shrinking with changing screen sizes

I am currently working on creating a portfolio website similar to this one. Check out the Website Here Typically, when the screen size is reduced to less than half of the full width, the content of a website tends to be hidden rather than shrinking. Howe ...

Separating content beautifully with a vertical divider in Material UI's Appbar

Trying to incorporate a vertical Divider component within my Appbar in material-ui has proven to be quite challenging. Despite following a solution recommended on Stack Overflow, the issue persists and I am unable to resolve it: Adding vertical divider to ...