CSS3 realize circular rotation countdown code sharing

Source: Internet
Author: User
Many of the H5 interface has a rotation countdown effect, a constant rotation of the reduced animation, similar to this. This article mainly and everybody introduced the CSS3 realizes the circular rotation countdown function, needs the friend can refer under, hoped can help to everybody.

Studied today, can be obtained by border rotation. Generally we can get a four-segment circle through border.

See the Pen Circle by Stoneniqiu (@stoneniqiu) on Codepen.

Next, you can create a countdown effect by rotating it:

See the Pen circle-rotate by Stoneniqiu (@stoneniqiu) on Codepen.

The first rotation is 45 degrees to make the semicircle stand up. Then rotate 180 degrees.


. rightcircle{                border-top:. 4rem solid #8731fd;                Border-right:. 4rem solid #8731fd;                right:0;                Transform:rotate (45deg)            }. Right_cartoon {                -webkit-animation:circleprogressload_right 10s linear infinite forwards;                Animation:circleprogressload_right 10s linear infinite forwards;            } @keyframes Circleprogressload_right {                0% {                    -webkit-transform:rotate (46deg);                    Transform:rotate (46deg)                }                50%,to {                    -webkit-transform:rotate ( -136deg);                    Transform:rotate ( -136deg)                }            }

After all, not really reduced, to appear a color in the majority can be pieced together by two semicircular.

See the Pen Circle-timer by Stoneniqiu (@stoneniqiu) on Codepen.


@keyframes Circleprogressload_left {                0%,50% {                    -webkit-transform:rotate (46deg);                    Transform:rotate (46deg)                } to                           {                    -webkit-transform:rotate ( -136deg);                    Transform:rotate ( -136deg)                }            }

Note that the right line to 5 seconds, and then left to wait five seconds, where the effect of CSS animation slightly different, the right is 0% start, 50%,to. On the left is 0%,50%, then to, 5 seconds to wait for this implementation. This is the effect of the spin countdown, and finally, the last few seconds of the emergency can be highlighted by modifying the border-left color of the left half loop.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.