Text 3D Animation: HTML CSS @rayen-code

Text 3D Animation: HTML CSS

Hello World
Hello World

HTML Code

<!-- -------------------- HTML -------------------- -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title> 3D Text Transform </title>
<link rel="stylesheet" href="style.css">
</head>
<body>

    <div class="container">
        <div class="wall left_wall">
            <span>Hello World</span>
        </div>
        <div class="wall right_wall">
            <span>Hello World</span>
        </div>
    </div>
    
</body>
</html>

CSS Code

/*-------------------- CSS --------------------*/
/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: sans-serif;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #e0eeff;
}

.container {
    display: flex;
    perspective: 100px;
}

.wall {
    display: flex;
    align-items: center;
    width: 400px;
    height: 200px;
    font-size: 4rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
}

.left_wall {
    background-color: #5b7eca;
    color: #00388b;
    transform: rotateY(-15deg);
    transform-origin: right;
}

.right_wall {
    background-color: #84a1df;
    color: #d7ecfa;
    transform: rotateY(15deg);
    transform-origin: left;
}

.wall span {
    position: absolute;
    animation: anime 5s linear infinite;
    text-shadow: -8px 3px 3px rgba(0, 0, 0, 0.4);
}

.left_wall span {
    animation-delay: 2.5s;
    left: 105%;
}

@keyframes anime {
    0% {
        left: 100%;
    }

    100% {
        left: -100%;
    }
}

0 Comments