我正在尝试创建一个自定义进度条,如下图所示:
我认为创建此类组件的最佳选择是使用 JavaScript 和 SVG 或 Canvas,现在我正尝试在 Raphael JS 中创建它。
我想知道这是否可能,或者这是否是一件难以置信的难事,或者 Raphael 不是做这件事的最佳工具,我对 Raphael 很陌生,我所能做的就是使用 Raphael JS 重新创建形状.
window.onload = function() {
var paper = Raphael("holder", 500, 500);
var border = paper.path("M177.726,35.14c-6.51-19.56-24.73-30.02-46.369-35.14l-4.061,3.7c16.59,5.44,29.609,15.21,33.25,30.37c6.891,28.729-26.721,55.2-70.56,55.2c-43.84,0-77.45-26.471-70.55-55.2c3.64-15.16,16.65-24.93,33.24-30.37L48.616,0c-21.64,5.12-39.86,15.58-46.37,35.14c-12.83,38.52,31.03,74,87.74,74C146.696,109.14,190.556,73.66,177.726,35.14z M89.986,107.014c-33.546,0-64.678-13.115-79.311-33.411C2.173,61.81-0.044,48.742,4.263,35.812C9.725,19.401,24.444,8.14,48.018,2.332l0.595,0.542C31.43,9.313,20.658,19.875,17.369,33.574c-2.601,10.831,0.055,21.67,7.682,31.346c12.873,16.331,37.755,26.477,64.935,26.477c27.177,0,52.06-10.145,64.936-26.475c7.63-9.676,10.29-20.516,7.691-31.348c-3.289-13.696-14.065-24.26-31.253-30.701l0.594-0.542c23.574,5.809,38.293,17.069,43.754,33.48c4.307,12.93,2.09,25.998-6.412,37.791C154.663,93.898,123.532,107.014,89.986,107.014z");
var fill = paper.path("M173.587,33.481C168.126,17.069,153.407,5.809,129.833,0l-0.594,0.541c17.188,6.441,27.963,17.004,31.252,30.701c2.6,10.832-0.061,21.672-7.691,31.348c-12.875,16.33-37.758,26.475-64.936,26.475c-27.18,0-52.063-10.146-64.936-26.477c-7.627-9.676-10.283-20.516-7.682-31.346C18.536,17.543,29.309,6.981,46.491,0.542L45.896,0C22.322,5.809,7.603,17.069,2.142,33.48c-4.307,12.931-2.09,25.998,6.412,37.791c14.633,20.296,45.764,33.411,79.311,33.411s64.678-13.115,79.311-33.411C175.677,59.478,177.894,46.411,173.587,33.481z");
border.attr({
fill: "#00FFFF",
});
fill.attr({
fill: "#99FF00",
});
}