SVG涓庡褰╂笎鍙樺渾鐜€掕鏃舵晥鏋滃疄渚嬮〉闈?/h1>
鍥炲埌鐩稿叧鏂囩珷 »
鏁堟灉锛?/h3>
浠g爜锛?/h3>
CSS浠g爜锛?/h5>
svg {
transform: rotate(-0.05deg);
}
circle {
transition: stroke-dasharray .2s;
}
.time-count-x {
line-height: 1.5;
position: relative;
}
.time-second {
position: absolute;
top: 50%; left: 0; right: 0;
margin-top: -.75em;
text-align: center;
font-size: 100px;
}
HTML浠g爜锛?/h5>
<div id="timeCountX" class="time-count-x">
<svg width="440" height="440" viewBox="0 0 440 440" class="center">
<defs>
<linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient1">
<stop offset="0%" stop-color="#e52c5c"></stop>
<stop offset="100%" stop-color="#ab5aea"></stop>
</linearGradient>
<linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient2">
<stop offset="0%" stop-color="#4352f3"></stop>
<stop offset="100%" stop-color="#ab5aea"></stop>
</linearGradient>
</defs>
<g transform="matrix(0,-1,1,0,0,440)">
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="#f0f1f5" fill="none" stroke-dasharray="1069 1069"></circle>
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient1')" fill="none" stroke-dasharray="1069 1069"></circle>
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient2')" fill="none" stroke-dasharray="534.5 1069"></circle>
</g>
</svg>
<span id="timeSecond" class="time-second"></span>
</div>
JS浠g爜锛?/h5>
// 鍙傝椤甸潰婧愪唬鐮?
鏁堟灉锛?/h3>
浠g爜锛?/h3>
CSS浠g爜锛?/h5>
svg {
transform: rotate(-0.05deg);
}
circle {
transition: stroke-dasharray .2s;
}
.time-count-x {
line-height: 1.5;
position: relative;
}
.time-second {
position: absolute;
top: 50%; left: 0; right: 0;
margin-top: -.75em;
text-align: center;
font-size: 100px;
}
HTML浠g爜锛?/h5>
<div id="timeCountX" class="time-count-x">
<svg width="440" height="440" viewBox="0 0 440 440" class="center">
<defs>
<linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient1">
<stop offset="0%" stop-color="#e52c5c"></stop>
<stop offset="100%" stop-color="#ab5aea"></stop>
</linearGradient>
<linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient2">
<stop offset="0%" stop-color="#4352f3"></stop>
<stop offset="100%" stop-color="#ab5aea"></stop>
</linearGradient>
</defs>
<g transform="matrix(0,-1,1,0,0,440)">
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="#f0f1f5" fill="none" stroke-dasharray="1069 1069"></circle>
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient1')" fill="none" stroke-dasharray="1069 1069"></circle>
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient2')" fill="none" stroke-dasharray="534.5 1069"></circle>
</g>
</svg>
<span id="timeSecond" class="time-second"></span>
</div>
JS浠g爜锛?/h5>
// 鍙傝椤甸潰婧愪唬鐮?
CSS浠g爜锛?/h5>
svg {
transform: rotate(-0.05deg);
}
circle {
transition: stroke-dasharray .2s;
}
.time-count-x {
line-height: 1.5;
position: relative;
}
.time-second {
position: absolute;
top: 50%; left: 0; right: 0;
margin-top: -.75em;
text-align: center;
font-size: 100px;
}
HTML浠g爜锛?/h5>
<div id="timeCountX" class="time-count-x">
<svg width="440" height="440" viewBox="0 0 440 440" class="center">
<defs>
<linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient1">
<stop offset="0%" stop-color="#e52c5c"></stop>
<stop offset="100%" stop-color="#ab5aea"></stop>
</linearGradient>
<linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient2">
<stop offset="0%" stop-color="#4352f3"></stop>
<stop offset="100%" stop-color="#ab5aea"></stop>
</linearGradient>
</defs>
<g transform="matrix(0,-1,1,0,0,440)">
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="#f0f1f5" fill="none" stroke-dasharray="1069 1069"></circle>
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient1')" fill="none" stroke-dasharray="1069 1069"></circle>
<circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient2')" fill="none" stroke-dasharray="534.5 1069"></circle>
</g>
</svg>
<span id="timeSecond" class="time-second"></span>
</div>
JS浠g爜锛?/h5>
// 鍙傝椤甸潰婧愪唬鐮?
<div id="timeCountX" class="time-count-x"> <svg width="440" height="440" viewBox="0 0 440 440" class="center"> <defs> <linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient1"> <stop offset="0%" stop-color="#e52c5c"></stop> <stop offset="100%" stop-color="#ab5aea"></stop> </linearGradient> <linearGradient x1="1" y1="0" x2="0" y2="0" id="gradient2"> <stop offset="0%" stop-color="#4352f3"></stop> <stop offset="100%" stop-color="#ab5aea"></stop> </linearGradient> </defs> <g transform="matrix(0,-1,1,0,0,440)"> <circle cx="220" cy="220" r="170" stroke-width="50" stroke="#f0f1f5" fill="none" stroke-dasharray="1069 1069"></circle> <circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient1')" fill="none" stroke-dasharray="1069 1069"></circle> <circle cx="220" cy="220" r="170" stroke-width="50" stroke="url('#gradient2')" fill="none" stroke-dasharray="534.5 1069"></circle> </g> </svg> <span id="timeSecond" class="time-second"></span> </div>