svg環形百分比進度條
分享一段程式碼例項,它實現了環形百分比進度條效果。
程式碼例項如下:
[HTML] 純文字檢視 複製程式碼執行程式碼<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <style> * { box-sizing: border-box; } html, body { margin: 0 0; padding: 0; height: 100%; } body { -webkit-font-smoothing: antialiased; background: #212121; font-family: 'Roboto', Helvetica, Arial, sans-serif; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; } .donut { position: relative; width: 240px; height: 240px; } .donut__copy { text-align: center; width: 100%; height: 100%; padding-top: 68px; top: 0; left: 0; position: absolute; } .donut__title, .donut__secondary { display: block; margin: 0; padding: 0; } .donut__title, .donut__spic { color: #8a6fd5; font-weight: 200; } .donut__title { font-size: 79px; position: relative; animation: donutTitleFadeLeft 800ms 200ms cubic-bezier(0.99, 0.01, 0.22, 0.94) forwards; opacity: 0; transform: translateX(0); } .donut__spic { position: absolute; top: 20px; font-size: 30px; line-height: 1em; content: "%"; animation: donutTitleFadeRight 800ms 200ms cubic-bezier(0.99, 0.01, 0.22, 0.94) forwards; opacity: 0; transform: translateY(-20px); } @keyframes donutTitleFadeLeft { from { opacity: 0; transform: translateX(0); } to { opacity: 1; transform: translateX(-10px); } } @keyframes donutTitleFadeRight { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } } .donut__svg { transform: rotate(-90deg); } .donut__svg__circle--one { stroke-dasharray: 565.48668; stroke-dashoffset: 565; } .donut__svg__circle--one { animation: donut-show-one 1200ms cubic-bezier(0.99, 0.01, 0.62, 0.94) 0.5s forwards; transition: stroke-dasharray 400ms ease-in-out; } @keyframes donut-show-one { to { stroke-dashoffset: 101; } } .info { font-size: 14px; color: #999; position: absolute; flex: 1; bottom: 40px; width: 100%; left: 0; text-align: center; } .info a { color: #999; } </style> </head> <body> <div class="donut"> <svg width="240" height="240" xmlns="http://www.w3.org/2000/svg" class="donut__svg"> <circle id="donut-graph-x" class="donut__svg__scrim" r="90" cy="120" cx="120" stroke-width="3" stroke="#333" fill="none" /> <circle id="donut-graph" class="donut__svg__circle--one" r="90" cy="120" cx="120" stroke-width="4" stroke="url(#purple)" stroke-linejoin="round" stroke-linecap="round" fill="none" /> <defs> <linearGradient id="purple" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" stop-color="#7a5bcf" /> <stop offset="100%" stop-color="#8A6FD5" /> </linearGradient> </defs> </svg> <div class="donut__copy"> <span class="donut__title">82<span class="donut__spic">%</span></span> </div> </div> </body> </html>
相關文章
- canvas百分比環形進度條程式碼Canvas
- svg和css3建立環形漸變進度條SVGCSSS3
- canvas環形進度條效果Canvas
- Android花樣loading進度條(三)-配文字環形進度條Android
- 實現環形進度條效果【一】
- Js 百分比進度條JS
- jQuery環形旋轉載入進度條效果jQuery
- 用SVG實現進度環SVG
- 直播商城系統原始碼,環形進度條元件原始碼元件
- YCProgress自定義百分比進度條
- JavaScript百分比動態進度條JavaScript
- 直播電商平臺開發,環形進度條元件元件
- Flutter 波浪圓形進度條Flutter
- canvas錐形漸變進度條Canvas
- Android自定義圓形進度條Android
- 短視訊商城系統,Android進度條,自定義進度條,顯示百分比Android
- 用初中數學知識擼一個canvas環形進度條Canvas
- 一對一聊天原始碼,vue實現環形進度條元件原始碼Vue元件
- [-Flutter 自定義元件-] 圓形進度條Flutter元件
- CSS3圓形進度條效果CSSS3
- 使用canvas繪製圓形進度條Canvas
- vue 自定義指令實現,滾動條百分比進度條。Vue
- 自定義圓形進度條控制元件控制元件
- ios自定義圓環進度條iOS
- 基於Vue.js的簡單的svg進度條Vue.jsSVG
- 【新特性速遞】進度條,進度條,進度條
- echarts 繪製圓形進度條帶漸變色Echarts
- 可拖拽圓形進度條元件(支援移動端)元件
- css3 製作圓環進度條CSSS3
- 手把手使用 SVG + CSS 實現漸變進度環效果SVGCSS
- Vue canvas繪製圓形進度條動畫載入VueCanvas動畫
- Qt 進度條QT
- 前端學習筆記:使用canvas繪製有圓角的百分比進度條前端筆記Canvas
- 簡單進度條
- 學習進度條
- Python進度條技巧Python
- canvas 畫進度條Canvas
- HTML <progress> 進度條HTML
- wkwebView 新增 進度條WebView