Watch interactive screencast on Scrimba: https://scrimba.com/p/pEgDAM/cWknNUR
Created
November 3, 2022 13:29
-
-
Save HazzazBinFaiz/59029366f671b4649a77f3c97b245091 to your computer and use it in GitHub Desktop.
3d text marquee effects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="box"> | |
<div class="inner"> | |
<span>Hello World</span> | |
</div> | |
<div class="inner"> | |
<span>Hello World</span> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, | |
body { | |
height: 100%; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
background-color: navajowhite; | |
} | |
.box { | |
display: flex; | |
} | |
.box .inner { | |
width: 400px; | |
height: 200px; | |
line-height: 200px; | |
font-size: 4em; | |
font-family: sans-serif; | |
font-weight: bold; | |
white-space: nowrap; | |
overflow: hidden; | |
} | |
.box .inner:first-child { | |
background-color: indianred; | |
color: darkred; | |
transform-origin: right; | |
transform: perspective(100px) rotateY(-15deg); | |
} | |
.box .inner:last-child { | |
background-color: lightcoral; | |
color: antiquewhite; | |
transform-origin: left; | |
transform: perspective(100px) rotateY(15deg); | |
} | |
.box .inner span { | |
position: absolute; | |
animation: marquee 5s linear infinite; | |
} | |
.box .inner:first-child span { | |
animation-delay: 2.5s; | |
left: -100%; | |
} | |
@keyframes marquee { | |
from { | |
left: 100%; | |
} | |
to { | |
left: -100%; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment