Think about how to achieve the effect of "color" in the middle of "color"?

Hello, everyone. I don"t want to make a color run until the middle of the run, but the current situation is that the color color has already appeared before the color run is halfway through. I want to know how I should change my code until after the color run is finished. The progress2 just appeared and ran from the middle to the end?
this is codepen"s demo: https://codepen.io/lovelearni.
. I want the color to appear in the second second, not at the very beginning

.
---css---
.container1{
            position: relative;
            width: 100%;
            margin-top: 10px;
        }
        .progress1{
            height: 10px;
            width: 50%;
            background-color: yellow;
            border-radius: 2px;
            animation: becomeyellow 2s linear;
            display: flex;
            float: left;
        }
        
        .progress2{
            height: 10px;
            width: 50%;
            position: absolute;
            left: 50%;
            /*display: flex;
            float: right;*/
            background-color: green;
            border-radius: 2px;
            animation: becomegreen 2s 2s linear;
            
        }
        @keyframes becomeyellow{
            0%{
                width: 0%;
                background-color: red;
            }
            100%{
                width: 50%;
                background-color: yellow;
            }
        }
        @keyframes becomegreen{
            0%{
                width: 0%;
                background-color: yellow;
                display: none;
            }
            100%{
                width: 50%;
                background-color: green;
            }
        }

---html---
<div class="container1">
        <div class="progress1">
        </div>
        <div class="progress2">
    </div>
    </div>

I have tried to add display:none, directly to progress2, but after doing so, the color is gone. What should I do? Thank you very much!

Jan.15,2022

talk is cheap, show you the code.

.container1{
    position: relative;
    width: 100%;
    margin-top: 10px;
}
.progress1{
    height: 10px;
    width: 50%;
    background-color: yellow;
    border-radius: 2px;
    animation: becomeyellow 2s forwards;
    display: flex;
    float: left;
}
        
.progress2{
    height: 10px;
    width: 50%;
    position: absolute;
    left: 50%;
    /*display: flex;
    float: right;*/
    background-color: green;
    border-radius: 2px;
    animation: becomegreen 4s forwards;
}
@keyframes becomeyellow{
    0%{
        width: 0%;
        background-color: red;
    }
    100%{
        width: 50%;
        background-color: yellow;
    }
}
@keyframes becomegreen{
    0%{
        width: 0%;
    }
    50%{
        width: 0%;
        background-color: yellow;
    }
    100%{
        width: 50%;
        background-color: green;
    }
}

remove the delay of progress2 and change it to 4s. The width of the first 50% is 0.


I think if you just want to achieve the gradual change of the progress bar from red to yellow to green, you can simply achieve it as follows:

.container1{
  margin-top: 10px;
}
.progress{
  height: 10px;
  width: 0%;
  border-radius: 2px;
  animation: gradient 2s linear forwards;
}
@keyframes gradient{
  0% {
    background: red
   }
  50% {
    background: yellow;
  }
  100% {
    background: green;
    width: 100%;
  }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4758c-44c21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4758c-44c21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?