JSFiddle - React, Tailwind, and code Playground
by HDL52
HTML
<section class="star-wars">
<div class="crawl">
<div class="title">
<p>伪文</p>
<h1>新的希望</h1>
</div>
<p>
这是一个内战的时期。反叛舰队从一个隐秘的基地出击,赢得了他们对邪恶银河帝国的第一次胜利。
</p>
<p>
在战斗中,反叛间谍成功窃取了帝国终极武器“死星”的秘密计划。这是一个拥有足够力量摧毁整个星球的装甲空间站。
</p>
<p>
在帝国邪恶特工的追击下,莱娅公主急速返回家乡,带着可以拯救她的人民并恢复银河自由的窃取计划...
</p>
</div>
</section>
CSS
body {
width: 100%;
height: 100%;
background: #000;
overflow: hidden;
}
.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;
}
.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);
}
}
JavaScript
// https://css-tricks.com/snippets/css/star-wars-crawl-text/