鍍金池/ 問(wèn)答/HTML5  HTML/ css怎么制作像波浪的那種動(dòng)態(tài)效果?

css怎么制作像波浪的那種動(dòng)態(tài)效果?

如圖的水波穩(wěn),怎么做到像那種波懂的動(dòng)態(tài)效果呢

clipboard.png

回答
編輯回答
青檸
2017年2月18日 14:05
編輯回答
終相守
<html>
    <head>
        <link rel="stylesheet" href="index.css">
    </head>
    <body>
        <div class="container">
            <p class="title">39%</p>
            <span class="wave"></span>
            <span class="wave"></span>
            <span class="wave"></span>
        </div>
    </body>
</html>
html, body {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(antiquewhite, rgb(173, 245, 255));
}

.container {
    width: 300px;
    height: 300px;
    background-color: whitesmoke;
    background-image: linear-gradient(
        darkblue,
        rgba(255, 255, 255, 0) 80%,
        rgba(255, 255, 255, 0.5)
    );
    border-radius: 50%;
    box-shadow: 0 2px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.container .title {
    color: white;
    font-size: 24px;
    font-family: serif;
    text-align: center;
    text-transform: uppercase;
    line-height: 250px;
    letter-spacing: 0.4em;
    z-index: 1;
    position: absolute;
    width: 100%;
}

.container .wave {
    width: 500px;
    height: 500px;
    position: absolute;
    background-color: deepskyblue;
    top: -250px;
    left: -100px;
    filter: opacity(0.4);
    border-radius: 43%;
    animation: drift linear infinite;
    transform-origin: 50% 48%;
}

.container .wave:nth-of-type(1) {
    animation-duration: 5s;
}

.container .wave:nth-of-type(2) {
    animation-duration: 7s;
}

.container .wave:nth-of-type(3) {
    animation-duration: 9s;
    background-color: red;
    filter: opacity(0.1);
}

@keyframes drift {
    from {
        transform: rotate(360deg);
    }
}
2018年3月10日 10:54