H5ComponentPie.js: 113 行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | // 生长动画 var draw = function ( per ){ ctx.clearRect(0,0,w,h); ctx.beginPath(); ctx.moveTo(r,r); if (per <=0){ ctx.arc(r,r,r,0,2*Math.PI); component.find( '.text' ).css( 'opacity' ,0) } else { ctx.arc(r,r,r,sAngel,sAngel+2*Math.PI*per, true ); } ctx.fill(); ctx.stroke(); if ( per >= 1){ component.find( '.text' ).css( 'transition' , 'all 0s' ); // --- H5ComponentPie.reSort( component.find('.text') ); // +++ 以下3行 component.find( '.text' ).each( function (i) { H5ComponentPie.reSort( component.find( '.text' ).slice(i) ) }) component.find( '.text' ).css( 'transition' , 'all 1s' ); component.find( '.text' ).css( 'opacity' ,1); ctx.clearRect(0,0,w,h); } } draw(0); |