2014-06-06 34 views

回答

0

使用这个(纯CSS /无javascript):

我创建一个例子,可能仍然不是你在找什么,但这是我最亲近的。

例(Demo in jsfiddle):

<style> 
@-webkit-keyframes rotate { 
    from { 
     -webkit-transform: rotate(0deg); 
    } 

    to { 
     -webkit-transform: rotate(360deg); 
    } 
} 

@-moz-keyframes rotate { 
    from { 
     -moz-transform: rotate(0deg); 
    } 

    to { 
     -moz-transform: rotate(360deg); 
    } 
} 

@-o-keyframes rotate { 
    from { 
     -o-transform: rotate(0deg); 
    } 

    to { 
     -o-transform: rotate(360deg); 
    } 
} 

@keyframes rotate { 
    from { 
     transform: rotate(0deg); 
    } 

    to { 
     transform: rotate(360deg); 
    } 
} 

#startupload:target { 
    /*"disable" button*/ 
    background: transparent; 
    border: none; 
} 

#startupload:target div.before { 
    /*Hide If has hash in url address browser*/ 
    display: none; 
} 

#startupload div.progress-circle-container { 
    position: relative; 
    height: 230px; 
    width: 230px; 
    margin: 0 auto; 
    display: none; /*hide If no Hash in address*/ 
} 
#startupload:target div.progress-circle-container { 
    display: block; /*Show If Hash in address*/ 
} 

#startupload div.progress-circle-container div.progress-circle-outer { 
    background-color: #faef85; 
    background-repeat: repeat-x; 
    background-image: -moz-linear-gradient(0deg, #d66f0f, #faef85); 
    background-image: -webkit-linear-gradient(0deg, #d66f0f, #faef85); 
    background-image: -o-linear-gradient(0deg, #d66f0f, #faef85); 
    background-image: linear-gradient(0deg, #d66f0f, #faef85); 
    width: 230px; 
    height: 230px; 
    position: absolute; 
    -webkit-animation-play-state: paused; 
    -moz-animation-play-state: paused; 
    -o-animation-play-state: paused; 
    animation-play-state: paused; 
    -webkit-animation: rotate 2.2s infinite linear; 
    -moz-animation: rotate 2.2s infinite linear; 
    -o-animation: rotate 2.2s infinite linear; 
    animation: rotate 2.2s infinite linear; 
    -webkit-box-shadow: inset 0 2px 10px #d58513,inset 0 0 20px #b93d00,0 0 15px rgba(216, 140, 23, 0.25); 
    -moz-box-shadow: inset 0 2px 10px #d58513,inset 0 0 20px #b93d00,0 0 15px rgba(216, 140, 23, 0.25); 
    box-shadow: inset 0 2px 10px #d58513,inset 0 0 20px #b93d00,0 0 15px rgba(216, 140, 23, 0.25); 
    -webkit-border-radius: 200px; 
    -moz-border-radius: 200px; 
    border-radius: 200px; 
} 

#startupload:target div.progress-circle-container div.progress-circle-outer.animate { 
    -webkit-animation-play-state: running; 
    -moz-animation-play-state: running; 
    -o-animation-play-state: running; 
    animation-play-state: running; 
} 

#startupload div.progress-circle-container div.progress-circle-inner { 
    height: 170px; 
    width: 170px; 
    margin: 0 auto; 
    position: absolute; 
    left: 30px; 
    top: 30px; 
    -webkit-border-radius: 200px; 
    -moz-border-radius: 200px; 
    border-radius: 200px; 
    background-color: #fff;/*change color background*/ 
    -webkit-box-shadow: inset 0 2px 1px #ffffff,inset 0 -1px 1px rgba(0, 0, 0, 0.08),inset 0 -3px 1px rgba(0, 0, 0, 0.09),0 2px 2px rgba(0, 0, 0, 0.3); 
    -moz-box-shadow: inset 0 2px 1px #ffffff,inset 0 -1px 1px rgba(0, 0, 0, 0.08),inset 0 -3px 1px rgba(0, 0, 0, 0.09),0 2px 2px rgba(0, 0, 0, 0.3); 
    box-shadow: inset 0 2px 1px #ffffff,inset 0 -1px 1px rgba(0, 0, 0, 0.08),inset 0 -3px 1px rgba(0, 0, 0, 0.09),0 2px 2px rgba(0, 0, 0, 0.3); 
    text-align: center; 
} 
</style> 

<form action="#startupload"> 
    <button id="startupload" type="submit"> 
     <div class="before"> 
      Start upload 
     </div> 
     <div class="progress-circle-container"> 
      <div class="progress-circle-outer animate"> 
      </div> 
      <div class="progress-circle-inner"></div> 
     </div> 
    </button> 
</form> 

也许最终的目标,以达到最佳的是一样的东西:

css3 animations frame by frame

+0

发现这[文章](https://medium.com/secoya-tech/radial-progress-indicator-using-css-a917b80c43f9)它真的很接近 –

+0

@ 254code_rep你说的是“纯CSS”,但是这篇文章使用lesscss,所以可以使用javascript,那么我们可以使用canvas来代替CSS。 –

+0

@GuilhermeNascimento,更少的CSS是“纯CSS”,你只需要编译它。 JavaScript不会编译成CSS,是吗? :-D –