Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Creative Coding Club - Member Stats
Interests
CSS Animations
314
SVG Animation + Interactivity
254
Vanilla Javascript
253
Custom SVG Illustration
204
Greensock Animation Library
145
Animation With React
122
HTML5 Canvas
122
Mo.js Animation Library
107
D3.JS Data Visualization
95
THREE.JS
85
Web Animation API
73
Storyboarding for Web Animation
59
Region
North America
367
Western Europe
66
Asia
53
Latin America & Caribbean
19
Australia & New Zealand
16
Russian Commonwealth
13
Eastern Europe
13
Middle East
9
South Africa
7
North Africa
6
Baltics
2
css
body { font-family: "Brandon Grotesque", Arial; background: #EEE; margin-top: 30px; text-align: center; } body * { font-weight: 300; margin: 0; padding: 0; } h1, h2 { text-transform: uppercase; } @-webkit-keyframes bake-pie { from { -webkit-transform: rotate(0deg) translate3d(0, 0, 0); transform: rotate(0deg) translate3d(0, 0, 0); } } @keyframes bake-pie { from { -webkit-transform: rotate(0deg) translate3d(0, 0, 0); transform: rotate(0deg) translate3d(0, 0, 0); } } .pie-chart { font-family: "Open Sans", Arial; } .pie-chart--wrapper { width: 400px; margin: 30px auto; text-align: center; } .pie-chart__pie, .pie-chart__legend { display: inline-block; vertical-align: top; } .pie-chart__pie { position: relative; height: 200px; width: 200px; margin: 10px auto 35px; } .pie-chart__pie::before { content: ""; display: block; position: absolute; z-index: 1; width: 100px; height: 100px; background: #EEE; border-radius: 50%; top: 50px; left: 50px; } .pie-chart__pie::after { content: ""; display: block; width: 120px; height: 2px; background: rgba(0, 0, 0, 0.1); border-radius: 50%; box-shadow: 0 0 3px 4px rgba(0, 0, 0, 0.1); margin: 220px auto; } .slice { position: absolute; width: 200px; height: 200px; clip: rect(0px, 200px, 200px, 100px); -webkit-animation: bake-pie 1s; animation: bake-pie 1s; } .slice span { display: block; position: absolute; top: 0; left: 0; background-color: black; width: 200px; height: 200px; border-radius: 50%; clip: rect(0px, 200px, 200px, 100px); } .pie-chart__legend { display: block; list-style-type: none; padding: 0; margin: 0 auto; background: #FFF; padding: 0.75em 0.75em 0.05em; font-size: 13px; box-shadow: 1px 1px 0 #DDD, 2px 2px 0 #BBB; text-align: left; width: 65%; } .pie-chart__legend li { height: 1.25em; margin-bottom: 0.7em; padding-left: 0.5em; border-left: 1.25em solid black; } .pie-chart__legend em { font-style: normal; } .pie-chart__legend span { float: right; } .pie-charts { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row; } @media (max-width: 500px) { .pie-charts { -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; } }
JavaScript
function sliceSize(dataNum, dataTotal) { return (dataNum / dataTotal) * 360; } function addSlice(id, sliceSize, pieElement, offset, sliceID, color) { $(pieElement).append("
"); var offset = offset - 1; var sizeRotation = -179 + sliceSize; $(id + " ." + sliceID).css({ "transform": "rotate(" + offset + "deg) translate3d(0,0,0)" }); $(id + " ." + sliceID + " span").css({ "transform" : "rotate(" + sizeRotation + "deg) translate3d(0,0,0)", "background-color": color }); } function iterateSlices(id, sliceSize, pieElement, offset, dataCount, sliceCount, color) { var maxSize = 179, sliceID = "s" + dataCount + "-" + sliceCount; if( sliceSize <= maxSize ) { addSlice(id, sliceSize, pieElement, offset, sliceID, color); } else { addSlice(id, maxSize, pieElement, offset, sliceID, color); iterateSlices(id, sliceSize-maxSize, pieElement, offset+maxSize, dataCount, sliceCount+1, color); } } function createPie(id) { var listData = [], listTotal = 0, offset = 0, i = 0, pieElement = id + " .pie-chart__pie" dataElement = id + " .pie-chart__legend" color = [ "rgb(187,228,255)", "rgb(2,166,209)", "rgb(5,116,206)", "rgb(239,71,111)", "rgb(255,209,102)", "rgb(6,214,160)", "rgb(172,78,221)", "rgb(255,140,62)", "rgb(0,188,212)", "rgb(194,24,91)", "rgb(230,74,25)", "rgb(103,58,183)" ]; color = shuffle( color ); $(dataElement+" span").each(function() { listData.push(Number($(this).html())); }); for(i = 0; i < listData.length; i++) { listTotal += listData[i]; } for(i=0; i < listData.length; i++) { var size = sliceSize(listData[i], listTotal); iterateSlices(id, size, pieElement, offset, i, 0, color[i]); $(dataElement + " li:nth-child(" + (i + 1) + ")").css("border-color", color[i]); offset += size; } } function shuffle(a) { var j, x, i; for (i = a.length; i; i--) { j = Math.floor(Math.random() * i); x = a[i - 1]; a[i - 1] = a[j]; a[j] = x; } return a; } function createPieCharts() { createPie('.pieID--region' ); createPie('.pieID--operations' ); } createPieCharts();
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>创意编码会员统计-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号