- button
- half-transparent-border
- multiple-borders
- callout
- extended-bg-position
- inner-rounding
- stripes
- gridding
- polka
- checkerboard
- marching-ants
- footnote
- ellipse
- half-ellipse
- parallelograms-pseudo
- diamond-images
- bevel-corners-gradients
- scoop-corners
- trapezoid-tabs
- pie-static
- shadow
- color-tint-filter
- frosted-glass
- folded-corner
- hypenation
- line-breaks
- zebra-lines
- tab-size
- ampersands
- underlines
- text-effects
- circular-text
- cursor
- hit-area
- checkboxes
- weaken-background-by-shadow
- weaken-background-by-blur
- scrolling-hints
- image-slider
- intrinsic-sizing
- table-column-widths
- styling-sibling-count
- fluid-fixed
- vertical-centering
- sticky-footer
- bounce
- elastic
- frame-by-frame
- text-blink
- text-typing
- state-animations
- circular
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
pie-static
transform
<style>
@keyframes spin {
to {
transform: rotate(.5turn)
}
}
@keyframes bg {
50% {
background: grey;
}
}
.pie {
position: relative;
width: 200px;
line-height: 200px;
border-radius: 50%;
background: yellowgreen;
background-image: linear-gradient(to right, transparent 50%, grey 0);
color: transparent;
text-align: center;
}
.pie::before {
content: "";
position: absolute;
display: block;
top: 0;
left: 50%;
height: 100%;
width: 50%;
border-radius: 0 100% 100% 0/ 50%; /* make pseudo to be a half circle*/
background-color: inherit;
transform-origin: left;/* 0 50% */
animation: spin 50s linear infinite,
bg 100s step-end infinite;
animation-play-state: paused;
animation-delay: inherit;
}
</style>
<div class="pie" style="animation-delay: -60s">60%</div>
svg
<style>
@keyframes fill-up {
to {
stroke-dasharray: 100 100;
}
}
circle {
fill: yellowgreen;
stroke: #655;
stroke-width: 32;
/*stroke-dasharray: 0 100;*/
/*animation: fill-up 5s linear infinite;*/
}
svg {
width: 100px;
height: 100px;
transform: rotate(-90deg);
background: yellowgreen; /* fill background*/
border-radius: 50%;
}
</style>
<div class="pie">20%</div>
<script>
function $$(selector, context) {
context = context || document;
var elements = context.querySelectorAll(selector);
return Array.prototype.slice.call(elements);
}
$$('.pie').forEach(function (pie) {
var p = parseFloat(pie.textContent);
var NS = "http://www.w3.org/2000/svg";
var svg = document.createElementNS(NS, "svg");
var circle = document.createElementNS(NS, "circle");
var title = document.createElementNS(NS, "title");
circle.setAttribute("r", 16);
circle.setAttribute("cx", 16);
circle.setAttribute("cy", 16);
circle.setAttribute("stroke-dasharray", p + " 100");
svg.setAttribute("viewBox", "0 0 32 32");
title.textContent = pie.textContent;
pie.textContent = '';
svg.appendChild(title);
svg.appendChild(circle);
pie.appendChild(svg);
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论