@@ -33,13 +33,13 @@ angular.module('angular-svg-round-progress', [])
3333 return id ;
3434 } ;
3535 }
36-
36+
3737 if ( ! window . cancelAnimationFrame ) {
3838 window . cancelAnimationFrame = function ( id ) {
3939 clearTimeout ( id ) ;
4040 } ;
4141 }
42-
42+
4343 } ( ) ) ;
4444
4545
@@ -51,7 +51,7 @@ angular.module('angular-svg-round-progress', [])
5151 y : centerY + ( radius * Math . sin ( angleInRadians ) )
5252 } ;
5353 }
54-
54+
5555 var updateState = function ( value , total , R , ring , size , isSemicircle ) {
5656 if ( ! size ) {
5757 return ;
@@ -67,7 +67,7 @@ angular.module('angular-svg-round-progress', [])
6767 // arcSweep = endAngle - startAngle <= 180 ? "0" : "1",
6868 arcSweep = ( perc <= 180 ? "0" : "1" ) ,
6969 d = [
70- "M" , start . x , start . y ,
70+ "M" , start . x , start . y ,
7171 "A" , R , R , 0 , arcSweep , 0 , end . x , end . y
7272 ] . join ( " " ) ;
7373
@@ -77,8 +77,8 @@ angular.module('angular-svg-round-progress', [])
7777 var easeOutCubic = function ( currentIteration , startValue , changeInValue , totalIterations ) {
7878 // credits to http://www.kirupa.com/forum/showthread.php?378287-Robert-Penner-s-Easing-Equations-in-Pure-JS-(no-jQuery)
7979 return changeInValue * ( Math . pow ( currentIteration / totalIterations - 1 , 3 ) + 1 ) + startValue ;
80- } ;
81-
80+ } ;
81+
8282 return {
8383 restrict :'EA' ,
8484 scope :{
@@ -88,7 +88,8 @@ angular.module('angular-svg-round-progress', [])
8888 radius : "@" ,
8989 color : "@" ,
9090 bgcolor : "@" ,
91- stroke : "@"
91+ stroke : "@" ,
92+ iterations : "@"
9293 } ,
9394 link : function ( scope , element , attrs ) {
9495 var ring = element . find ( 'path' ) ,
@@ -151,7 +152,7 @@ angular.module('angular-svg-round-progress', [])
151152 start = oldValue === newValue ? 0 : ( oldValue || 0 ) , // fixes the initial animation
152153 val = newValue - start ,
153154 currentIteration = 0 ,
154- totalIterations = 50 ;
155+ totalIterations = scope . iterations || 50 ;
155156
156157 if ( angular . isNumber ( resetValue ) ) {
157158 // the reset value fixes problems with animation, caused when limiting the scope.current
@@ -163,9 +164,9 @@ angular.module('angular-svg-round-progress', [])
163164 ( function animation ( ) {
164165 if ( currentIteration <= totalIterations ) {
165166 updateState (
166- easeOutCubic ( currentIteration , start , val , totalIterations ) ,
167- max ,
168- radius ,
167+ easeOutCubic ( currentIteration , start , val , totalIterations ) ,
168+ max ,
169+ radius ,
169170 ring ,
170171 size ,
171172 isSemicircle
@@ -174,7 +175,7 @@ angular.module('angular-svg-round-progress', [])
174175 requestAnimationFrame ( animation ) ;
175176 currentIteration ++ ;
176177 } ;
177- } ) ( ) ;
178+ } ) ( ) ;
178179 } ;
179180
180181 scope . $on ( 'renderCircle' , renderCircle ) ;
0 commit comments