我試圖削減片出一個圓圈,但它被證明是難度比我原來預期的...創建自定義樣式餅圈
最好,我不想使用谷歌圖表和任何其他等價物,因爲我需要儘可能多地控制此圓的樣式(最終結果是加載環)。我還需要能夠使用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