CSS3實現(xiàn)三角形不斷放大效果
發(fā)布時間:2021-04-13 15:36:24 作者:&小小白&
我要評論

這篇文章主要介紹了CSS3實現(xiàn)三角形不斷放大效果,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
一、CSS3三角形不斷放大特效
11.1 圖片預覽
11.2 index.html代碼
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>CSS3三角形不斷放大特效</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="wrapper"> <svg class="triangle-canvas" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg"> <polygon class="triangle triangle-1" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-2" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-3" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-4" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-5" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-6" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-7" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-8" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-9" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-10" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-11" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-12" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-13" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-14" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-15" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-16" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-17" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-18" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-19" points="500,200 759,650 241,650" /> <polygon class="triangle triangle-20" points="500,200 759,650 241,650" /> </svg> </div> </body> </html>
11.3 style.css代碼
html { height: 100%; } body { padding: 0; margin: 0; height: 100%; background: #642B73; /* fallback for old browsers */ /* Chrome 10-25, Safari 5.1-6 */ background: linear-gradient(to left, #C6426E, #642B73); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ } .wrapper { overflow: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .triangle-canvas { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .triangle { fill: none; stroke: #fff; stroke-width: 15; -webkit-transform-origin: center center; transform-origin: center center; -webkit-animation: triangle-animation 10s linear infinite; animation: triangle-animation 10s linear infinite; } .triangle-1 { -webkit-animation-delay: 0s; animation-delay: 0s; } .triangle-2 { -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .triangle-3 { -webkit-animation-delay: -1s; animation-delay: -1s; } .triangle-4 { -webkit-animation-delay: -1.5s; animation-delay: -1.5s; } .triangle-5 { -webkit-animation-delay: -2s; animation-delay: -2s; } .triangle-6 { -webkit-animation-delay: -2.5s; animation-delay: -2.5s; } .triangle-7 { -webkit-animation-delay: -3s; animation-delay: -3s; } .triangle-8 { -webkit-animation-delay: -3.5s; animation-delay: -3.5s; } .triangle-9 { -webkit-animation-delay: -4s; animation-delay: -4s; } .triangle-10 { -webkit-animation-delay: -4.5s; animation-delay: -4.5s; } .triangle-11 { -webkit-animation-delay: -5s; animation-delay: -5s; } .triangle-12 { -webkit-animation-delay: -5.5s; animation-delay: -5.5s; } .triangle-13 { -webkit-animation-delay: -6s; animation-delay: -6s; } .triangle-14 { -webkit-animation-delay: -6.5s; animation-delay: -6.5s; } .triangle-15 { -webkit-animation-delay: -7s; animation-delay: -7s; } .triangle-16 { -webkit-animation-delay: -7.5s; animation-delay: -7.5s; } .triangle-17 { -webkit-animation-delay: -8s; animation-delay: -8s; } .triangle-18 { -webkit-animation-delay: -8.5s; animation-delay: -8.5s; } .triangle-19 { -webkit-animation-delay: -9s; animation-delay: -9s; } .triangle-20 { -webkit-animation-delay: -9.5s; animation-delay: -9.5s; } @-webkit-keyframes triangle-animation { 0% { -webkit-transform: scale(0) rotate(0deg); transform: scale(0) rotate(0deg); opacity: 1; } 100% { -webkit-transform: scale(3) rotate(45deg); transform: scale(3) rotate(45deg); opacity: 0; } } @keyframes triangle-animation { 0% { -webkit-transform: scale(0) rotate(0deg); transform: scale(0) rotate(0deg); opacity: 1; } 100% { -webkit-transform: scale(3) rotate(45deg); transform: scale(3) rotate(45deg); opacity: 0; } }
到此這篇關于CSS3實現(xiàn)三角形不斷放大效果的文章就介紹到這了,更多相關css三角形放大特效內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持腳本之家!
相關文章
純CSS3+DIV實現(xiàn)小三角形邊框效果的示例代碼
這篇文章主要介紹了純CSS3+DIV實現(xiàn)小三角形邊框,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-08-03詳解css如何利用 :before :after 寫小三角形
這篇文章主要介紹了詳解css如何利用 :before :after 寫小三角形的相關資料,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-01-22- 這篇文章主要介紹了CSS3 畫基本圖形,圓形、橢圓形、三角形等的相關資料,需要的朋友可以參考下2016-09-20
- 這篇文章主要介紹了用CSS3繪制三角形的簡單方法,是CSS前端繪圖的基礎,需要的朋友可以參考下2015-07-17
- 圖片的布局和排版非常重要,純大部分網(wǎng)頁或多或少都會用到圖片。特別是對于圖片較多的網(wǎng)頁,今天要給大寫帶來一款純css3實現(xiàn)圖片三角形排列。適合一系列的圖片,需要的朋友2014-10-17
使用css創(chuàng)建三角形 使用CSS3創(chuàng)建3d四面體原理及代碼(html5實踐)
今天讀了篇關于如何使用css3創(chuàng)建3d四面體的文章,覺的相當不錯,所以拿出來和大家分享一下,如何使用div+css創(chuàng)建三角形。在這里我先把相關代碼粘貼出來,然后再為大家講解2013-01-06