11
22<!doctype html>
3- < html lang ="en ">
3+ < html lang ="en " ng-app =" demo " >
44< head >
55 < meta charset ="UTF-8 ">
66 < title > Angular SVG round progressbar demo</ title >
5757
5858 form {
5959 text-align : left;
60- width : 270 px ;
60+ width : 300 px ;
6161 margin : 20px auto;
6262 }
6363
6464 form > div {
6565 margin-bottom : 5px ;
6666 }
6767
68- input {
68+ input , select {
6969 float : right;
7070 padding : 5px ;
7171 }
7777 }
7878 </ style >
7979</ head >
80- < body ng-app =" demo ">
81- < div class ="container " ng-controller =" demoCtrl " >
80+ < body ng-controller =" demoCtrl ">
81+ < div class ="container ">
8282 < a class ="back " href ="https://github.com/crisbeto/angular-svg-round-progressbar "> Back to project repo</ a >
8383
8484 < h2 > Sample progressbar</ h2 >
@@ -93,7 +93,8 @@ <h2>Sample progressbar</h2>
9393 radius ="{{ radius }} "
9494 semi ="isSemi "
9595 stroke ="{{ stroke }} "
96- iterations ="{{ iterations }} ">
96+ iterations ="{{ iterations }} "
97+ animation ="{{ currentAnimation }} ">
9798 </ div >
9899 </ div >
99100
@@ -131,6 +132,16 @@ <h3>Customize!</h3>
131132 < input type ="number " ng-model ="radius "/>
132133 </ div >
133134
135+ < div class ="cf ">
136+ < label > Iterations:</ label >
137+ < input type ="number " ng-model ="iterations "/>
138+ </ div >
139+
140+ < div class ="cf ">
141+ < label > Animation:</ label >
142+ < select ng-model ="currentAnimation " ng-options ="animation for animation in animations "> </ select >
143+ </ div >
144+
134145 < div class ="cf ">
135146 < label > Color:</ label >
136147 < input type ="color " ng-model ="currentColor "/>
@@ -140,28 +151,23 @@ <h3>Customize!</h3>
140151 < label > Background color:</ label >
141152 < input type ="color " ng-model ="bgColor "/>
142153 </ div >
143-
144- < div class ="cf ">
145- < label > Iterations:</ label >
146- < input type ="number " ng-model ="iterations "/>
147- </ div >
148154 </ form >
149155 </ div >
150156
151- < div class ="container " ng-controller =" demoCtrl " >
157+ < div class ="container ">
152158 < h2 > Upload progress example</ h2 >
153159 < div class ="progress-wrapper ">
154- < div class ="progress "> {{ ((uploadCurrent/100)*100) | number:0 }}%</ div >
160+ < div class ="progress " ng-style =" {'font-size': ((radius + stroke)/(isSemi ? 3.5 : 3))+'px'} " > {{ ((uploadCurrent/100)*100) | number:0 }}%</ div >
155161 < div
156162 round-progress
157163 max ="100 "
158164 current ="uploadCurrent "
159- color ="#45ccce "
160- bgcolor ="#eaeaea "
161- radius ="100 "
165+ color ="{{ currentColor }} "
166+ bgcolor ="{{ bgColor }} "
167+ radius ="{{ radius }} "
162168 semi ="isSemi "
163- stroke ="15 " >
164- </ div >
169+ stroke ="{{ stroke }} "
170+ animation =" {{ currentAnimation }} " > </ div >
165171 </ div >
166172
167173 < button ng-click ="start(); "> Start</ button >
@@ -170,20 +176,22 @@ <h2>Upload progress example</h2>
170176 </ div >
171177
172178
173- < script src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16 /angular.min .js "> </ script >
179+ < script src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28 /angular.js "> </ script >
174180 < script src ="roundProgress.js "> </ script >
175181 < script >
176182 angular . module ( 'demo' , [ 'angular-svg-round-progress' ] )
177- . controller ( 'demoCtrl' , [ '$scope' , '$timeout' , '$rootScope' , function ( $scope , $timeout , $rootScope ) {
178-
179- $scope . current = 27 ,
180- $scope . max = 50 ,
181- $scope . uploadCurrent = 0 ,
182- $scope . stroke = 15 ,
183- $scope . radius = 100 ,
184- $scope . isSemi = false ,
185- $scope . currentColor = '#45ccce' ,
186- $scope . bgColor = '#eaeaea'
183+ . controller ( 'demoCtrl' , [ '$scope' , '$timeout' , 'roundProgressService' , function ( $scope , $timeout , roundProgressService ) {
184+
185+ $scope . current = 27 ;
186+ $scope . max = 50 ;
187+ $scope . uploadCurrent = 0 ;
188+ $scope . stroke = 15 ;
189+ $scope . radius = 100 ;
190+ $scope . isSemi = false ;
191+ $scope . currentColor = '#45ccce' ;
192+ $scope . bgColor = '#eaeaea' ;
193+ $scope . iterations = 50 ;
194+ $scope . currentAnimation = 'easeOutCubic' ;
187195
188196 var random = function ( min , max ) {
189197 return Math . round ( Math . floor ( Math . random ( ) * ( max - min + 1 ) + min ) ) ;
@@ -194,10 +202,6 @@ <h2>Upload progress example</h2>
194202 $scope . current += ( amount || 1 ) ;
195203 } ;
196204
197- $scope . $watchCollection ( '[max, stroke, radius, isSemi, currentColor, bgColor, iterations]' , function ( newValue , oldValue ) {
198- $rootScope . $broadcast ( 'renderCircle' ) ;
199- } ) ;
200-
201205 $scope . decrement = function ( amount ) {
202206 $scope . current -= ( amount || 1 ) ;
203207 } ;
@@ -210,7 +214,7 @@ <h2>Upload progress example</h2>
210214 if ( $scope . uploadCurrent < 100 ) {
211215 $scope . start ( ) ;
212216 }
213- } , random ( 300 , 500 ) ) ;
217+ } , random ( 100 , 500 ) ) ;
214218 } ;
215219
216220 $scope . stop = function ( ) {
@@ -222,6 +226,11 @@ <h2>Upload progress example</h2>
222226 $scope . uploadCurrent = 0 ;
223227 } ;
224228
229+ $scope . animations = [ ] ;
230+
231+ angular . forEach ( roundProgressService . animations , function ( value , key ) {
232+ $scope . animations . push ( key ) ;
233+ } ) ;
225234 } ] ) ;
226235 </ script >
227236</ body >
0 commit comments