我试图削减片出一个圆圈,但它被证明是难度比我原来预期的...创建自定义样式饼圈
最好,我不想使用谷歌图表和任何其他等价物,因为我需要尽可能多地控制此圆的样式(最终结果是加载环)。我还需要能够使用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>
我想最终的结果看起来与此类似:
如果不使用canvas或svg元素,这将非常困难。 – Shomz
@Shomz我认为可能是这样的:-(Canvas和SVG是我没有经验的一件事,难么? –
@Shomz我倾向于同意,你不能在CSS中这样做。我认为使用画布会更快 – Mouser