body {
    margin: 0;
}

.anim {
    border: 10px solid red;
    width: 98.0%;
    height: 100px;
    background-color: aqua;
    color: antiquewhite;
    text-align: center;
    font-size: 48pt;
    border-bottom: 10px solid royalblue;

    position: absolute;
    top: 0;
    /*обращение к элементу top (к высоте) за 2 секунды плавный переход (ease-in-out)*/
    transition: top 2s ease-in-out;
    /*render имя правила смотри ниже. infinite - зацикливание*/
    animation: render 10s ease-in-out infinite;
}

/*При наведении на anim изменяется top с помощью transition*/
.anim:hover {
    top: -110px;
}

/*Правило которое указывает код анимации*/
@keyframes render {
    0% {
        background-color: #3D3BFF;
    }
    50% {
        background-color: #d293a7;
    }
    100% {
        background-color: teal;
    }
}

.box {
    width: 100px;
    height: 100px;
    background-color: #6B8E23;
    position: relative;
    top: 120px;
    
    animation: render_2 10s ease-in-out infinite;
}

@keyframes render_2 {
    0% {
        top: 120px;
        left: 0;
        background-color: #3D3BFF;
    }
    25% {
        top: 120px;
        left: 50%;
        background-color: cadetblue;
        border-radius: 50%;
    }
    50% {
        top: 240%;
        left: 50%;
        background-color: #d293a7;
    }
    75% {
        top: 240%;
        left: 0;
        background-color: teal;
        border-radius: 50%;
    }
}