我正在尝试从圆圈中切出一片,但事实证明它比我原先预期的要难...
最好,我不想使用 Google Charts 和任何其他等效项,因为我需要尽可能多地控制此圆圈的样式(最终结果是加载环)。我还需要能够使用 jQuery 或 CSS 对切片的大小进行动画处理。
请原谅我,但我还没有走多远,这就是我的全部:
我关注的圈子是#layer_2
和#layer_3
。这是这个圈子的代码:
#layer_2 {
border-radius: 50%;
width: 212px;
height: 212px;
margin: 14px;
background: #5c00d2;
background: -moz-linear-gradient(45deg, #5c00d2 0%, #d586f4 100%);
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #5c00d2), color-stop(100%, #d586f4));
background: -webkit-linear-gradient(45deg, #5c00d2 0%, #d586f4 100%);
background: -o-linear-gradient(45deg, #5c00d2 0%, #d586f4 100%);
background: -ms-linear-gradient(45deg, #5c00d2 0%, #d586f4 100%);
background: linear-gradient(45deg, #5c00d2 0%, #d586f4 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#5c00d2', endColorstr='#d586f4', GradientType=1);
-webkit-box-shadow: inset 0px 0px 5px 3px rgba(5, 71, 110, 0.5);
-moz-box-shadow: inset 0px 0px 5px 3px rgba(5, 71, 110, 0.5);
box-shadow: inset 0px 0px 5px 3px rgba(5, 71, 110, 0.5);
}
#layer_3 {
border-radius: 50%;
width: 212px;
height: 212px;
margin: 0;
background: transparent;
-webkit-box-shadow: inset 0px 0px 30px 0px rgba(0, 0, 0, 0.3);
-moz-box-shadow: inset 0px 0px 30px 0px rgba(0, 0, 0, 0.3);
box-shadow: inset 0px 0px 30px 0px rgba(0, 0, 0, 0.3);
}
<div id="layer_2">
<div id="layer_3"></div>
</div>
我希望最终结果看起来与此类似:
最佳答案
试试这个
layer_2
background-image:
linear-gradient(-90deg, transparent 50%, #5c00d2 50%),
linear-gradient(200deg, #5c00d2 50%, transparent 50%);
关于javascript - 创建自定义饼图样式圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31673666/