近來在逛逛網頁時,發現現在的形象網站都做得很 Fashion,也富有許多動畫效果,原本以為是用 GIF 動畫圖片或用 CANVAS 畫出來,但打開 F12 發現大部分都是用 HTML 與 CSS 拼湊出來的,很難想像設計這些動畫的工程師是多麼富有創意。今天限量來研究了一個類似水桶上的水波動動畫效果。
以下為實作的程式碼:
CSS
以下為實作的程式碼:
CSS
.wave-container {
position: relative;
background-color: #2A73FE;
width: 200px;
height: 150px;
margin: 0 auto;
}
.wave {
position: absolute;
bottom: 60%;
width: 200px;
height: 100px;
}
.wave::before {
content: "";
background-color: #fff;
opacity: 0.5;
border-radius: 40%;
position: absolute;
left: -75%;
bottom: 25%;
width: 500px;
height: 500px;
-webkit-animation: spin 8s linear infinite;
-moz-animation: spin 8s linear infinite;
animation: spin 8s linear infinite;
}
.wave::after {
content: "";
background-color: #fff;
opacity: 0.5;
border-radius: 40%;
position: absolute;
left: -75%;
bottom: 25%;
width: 500px;
height: 500px;
-webkit-animation: spin 10s linear infinite;
-moz-animation: spin 10s linear infinite;
animation: spin 10s linear infinite;
}
@-moz-keyframes spin {
100% {
-moz-transform: rotate(360deg);
}
}
@-webkit-keyframes spin {
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes spin {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
HTML<div class="wave-container">
<div class="wave"></div>
</div>
Crowdfunding is a way to raise money from a large number of people. Large groups of people pool together small individual investments to provide the capital needed to get a company or project off the ground. Space bar test
回覆刪除