@nikitapremium

Почему анимация CSS идет в обратную сторону(справа налево) и как это исправить?

Почему анимация CSS идет в обратную сторону(справа налево) и как это исправить? Речь о @keyframes homeBgText

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Portfolio by Malyshenko Nikita</title>
    <link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
    <link rel="stylesheet" href="./styles/style.css">
</head>
<body>
    <!-- header -->
    <header class="header">
        <a href="#" class="header__logo">Nikita.</a>

        <nav class="header__menu">
            <ul class="header__list">
                <li class="header__item">
                    <a href="#home" class="header__link active">Home</a>
                </li>
                <li class="header__item">
                    <a href="#about" class="header__link">About</a>
                </li>
                <li class="header__item">
                    <a href="#education" class="header__link">Education</a>
                </li>
                <li class="header__item">
                    <a href="#skills" class="header__link">Skills</a>
                </li>
            </ul>
        </nav>
    </header>

    <!-- home -->
    <section class="home" id="home">
        <div class="home__content">
            <h1 class="home__title">Hi, I'm <span>Nikita Malyshenko</span></h1>
            <div class="home__text-animate">
                <h3>Frontend Developer</h3>
            </div>
            <p class="home__text">
                I'm a junior Frontend developer. I can create a website for your ideas and preferences.
            </p>

            <div class="home__buttons buttons">
                <a href="#" class="home__button btn">Hire me</a>
                <a href="#" class="home__button btn">Let's Talk</a>
            </div>
        </div>

        <ul class="home__contacts">
            <li class="home__contact">
                <a href="#" class="home__contact-link"><i class='bx bxl-vk' ></i></a>
            </li>
            <li class="home__contact">
                <a href="#" class="home__contact-link"><i class='bx bxl-telegram' ></i></a>
            </li>
        </ul>

        <div class="home__imgHover"></div>
    </section>

    <script src="./scripts/index.js"></script>
</body>
</html>


@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    outline: none;
    scroll-behavior: smooth;
    font-family: 'Poppins';
    color: inherit;
    list-style: none;
}

:root {
    --bg-color:   #29010c;
    --second-bg-color: #590219;
    --text-color: #fd7b7c;
    --main-color: #f80000;
}

/* html {
    overflow-x: hidden;
} */

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

section {
    min-height: 100vh;
    padding: 100px 150px 30px;
}

.buttons {
    width: 450px;
    display: flex;
    justify-content: space-between;
}

.btn {
    position: relative;
    width: 200px;
    height: 60px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 3px solid var(--main-color);
    border-radius: 6px;
    font-size: 20px;
    font-weight: 600;
    z-index: 1;
    letter-spacing: 2.5px;
    color: var(--bg-color);
    background-color: var(--main-color);
    transition: all .5s;
}

.btn::before{
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background-color: var(--bg-color);
    z-index: -1;
    transition: all .5s;
}

.btn:hover{
    color: var(--main-color);
}

.btn:hover::before{
    width: 100%;
}

.btn:nth-child(2) {
    background-color: transparent;
    color: var(--main-color);
}

.btn:nth-child(2)::before {
    background-color: var(--main-color);
}

.btn:nth-child(2):hover {
    color: var(--bg-color);
}

/* header */
.header {
    position: fixed;
    width: 100%;
    padding: 30px 150px;
    background-color: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    transition: all .3s;
}

.header.sticky {
    background-color: var(--bg-color);
}

.header__logo {
    font-size: 30px;
    font-weight: 700;
}

.header__list {
    display: flex;
}

.header__item + .header__item {
    margin-left: 40px;
}

.header__link {
    font-size: 20px;
    font-weight: 500;
    transition: all .3s;
}

.header__link:hover,
.header__link.active {
    color: var(--main-color);
}

/* home */
.home {
    display: flex;
    align-items: center;
    background-image: url('../images/home.png');
    background-repeat: no-repeat;
    background-position: right;
    border-bottom: 2px solid var(--main-color);
}

.home__content {
    max-width: 650px;
}

.home__title {
    font-size: 50px;
    line-height: 1.3;
    font-weight: 700;
}

.home__text-animate {
    position: relative;
}

.home__text-animate h3 {
    font-size: 30px;
    font-weight: 700;
    -webkit-text-stroke: .7px var(--main-color);
    color: transparent;
    background-image: linear-gradient(var(--main-color), var(--main-color));
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-position: 0 0;
    animation: homeBgText 6s linear infinite;
    animation-delay: 2s;
}

.home__text-animate h3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    border-right: 2px solid var(--main-color);
    z-index: -1;

}

.home__text {
    font-size: 20px;
    margin: 25px 0 50px;
}

.home__contacts {
    position: absolute;
    bottom: 50px;
    display: flex;
    justify-content: space-between;
    width: 180px;
}

.home__contact-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 70px;
    height: 70px;
    border: 3px solid var(--main-color);
    border-radius: 50%;
    font-size: 30px;
    position: relative;
    z-index: 1;
    overflow: hidden;
    color: var(--main-color);
    transition: all .5s;
}

.home__contact-link:hover {
    color: var(--bg-color);
}

.home__contact-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    border-radius: 50%;
    height: 100%;
    background-color: var(--main-color);
    transition: all .5s;
    z-index: -1;
}

.home__contact-link:hover::before {
    width: 100%;
}

.home__imgHover {
    position: absolute;
    top: 0;
    right: 0;
    width: 45%;
    height: 100%;
    background-color: transparent;
    transition: 3s;
}

.home__imgHover:hover {
    background-color: var(--bg-color);
    opacity: .7;
    box-shadow: 0 0 100px var(--main-color);
}

/* keyframes animation */
@keyframes homeBgText {
    0%, 10%, 100% {
        background-position:  -15rem 0;
    }

    65%, 85% {
        background-position:  20rem 0;
    }
}

@keyframes aboutSpinner {
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
  • Вопрос задан
  • 77 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
30 нояб. 2024, в 20:49
2000 руб./за проект
30 нояб. 2024, в 20:18
5000 руб./за проект