Skip to content

Commit a6600ac

Browse files
committed
Slightly nicer demo page.
1 parent a519d7a commit a6600ac

File tree

6 files changed

+202
-190
lines changed

6 files changed

+202
-190
lines changed

Gruntfile.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ module.exports = function(grunt) {
4747
base: 'build'
4848
},
4949
deploy: {
50-
src: ['index.html','roundProgress.js', 'roundProgress.min.js']
50+
src: [
51+
'index.html',
52+
'demo.css',
53+
'demo.js',
54+
'roundProgress.js',
55+
'roundProgress.min.js'
56+
]
5157
}
5258
},
5359
jshint: {

build/demo.css

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
*{
2+
box-sizing: border-box;
3+
}
4+
5+
body{
6+
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
7+
background: #fafafa;
8+
}
9+
10+
h2{
11+
margin: 0 0 40px;
12+
}
13+
14+
.cf:before,
15+
.cf:after {
16+
content: " ";
17+
display: table;
18+
}
19+
20+
.cf:after {
21+
clear: both;
22+
}
23+
24+
.progress-wrapper{
25+
position: relative;
26+
margin:20px auto;
27+
font-size: 40px;
28+
}
29+
30+
.progress{
31+
position: absolute;
32+
color: #bbb;
33+
font-weight: 100;
34+
line-height: 1;
35+
}
36+
37+
.container{
38+
width: 100%;
39+
max-width: 650px;
40+
margin: 40px auto 80px;
41+
text-align: center;
42+
padding: 40px;
43+
background: #fff;
44+
border: solid 1px #ccc;
45+
border-radius: 4px;
46+
}
47+
48+
button{
49+
display: inline-block;
50+
padding: 10px 20px;
51+
background: #45ccce;
52+
color:#fff;
53+
font-size: 16px;
54+
border:none;
55+
cursor: pointer;
56+
border-radius: 4px;
57+
text-align: center;
58+
margin: 0 5px 5px 0;
59+
}
60+
61+
form{
62+
text-align: left;
63+
max-width: 350px;
64+
margin: 30px auto;
65+
}
66+
67+
form > div{
68+
margin-bottom: 15px;
69+
}
70+
71+
input, select{
72+
float:right;
73+
padding: 5px;
74+
width: 150px;
75+
}
76+
77+
input[type="checkbox"]{
78+
width: auto;
79+
}
80+
81+
input[type="color"]{
82+
height: 30px;
83+
}
84+
85+
.back{
86+
position: fixed;
87+
top:5px;
88+
right:5px;
89+
}
90+
91+
.ng-cloak{
92+
display: none;
93+
}
94+
95+
@media(max-width: 480px){
96+
.back{
97+
position: static;
98+
display: block;
99+
text-align: center;
100+
}
101+
102+
input, select{
103+
width: 100%;
104+
margin-top: 5px;
105+
float:none;
106+
}
107+
108+
.container{
109+
margin-top: 25px;
110+
}
111+
}

build/demo.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
angular.module('demo', ['angular-svg-round-progressbar']).controller('demoCtrl', ['$scope', '$interval', '$timeout', '$window', 'roundProgressService', function($scope, $interval, $timeout, $window, roundProgressService){
2+
3+
$scope.current = 27;
4+
$scope.max = 50;
5+
$scope.offset = 0;
6+
$scope.timerCurrent = 0;
7+
$scope.uploadCurrent = 0;
8+
$scope.stroke = 15;
9+
$scope.radius = 125;
10+
$scope.isSemi = false;
11+
$scope.rounded = false;
12+
$scope.responsive = false;
13+
$scope.clockwise = true;
14+
$scope.currentColor = '#45ccce';
15+
$scope.bgColor = '#eaeaea';
16+
$scope.duration = 800;
17+
$scope.currentAnimation = 'easeOutCubic';
18+
$scope.animationDelay = 0;
19+
20+
$scope.increment = function(amount){
21+
$scope.current += (amount || 1);
22+
};
23+
24+
$scope.decrement = function(amount){
25+
$scope.current -= (amount || 1);
26+
};
27+
28+
$scope.animations = [];
29+
30+
angular.forEach(roundProgressService.animations, function(value, key){
31+
$scope.animations.push(key);
32+
});
33+
34+
$scope.getStyle = function(){
35+
var transform = ($scope.isSemi ? '' : 'translateY(-50%) ') + 'translateX(-50%)';
36+
37+
return {
38+
'top': $scope.isSemi ? 'auto' : '50%',
39+
'bottom': $scope.isSemi ? '5%' : 'auto',
40+
'left': '50%',
41+
'transform': transform,
42+
'-moz-transform': transform,
43+
'-webkit-transform': transform,
44+
'font-size': $scope.radius/3.5 + 'px'
45+
};
46+
};
47+
48+
$scope.getColor = function(){
49+
return $scope.gradient ? 'url(#gradient)' : $scope.currentColor;
50+
};
51+
52+
$scope.showPreciseCurrent = function(amount){
53+
$timeout(function(){
54+
if(amount <= 0){
55+
$scope.preciseCurrent = $scope.current;
56+
}else{
57+
var math = $window.Math;
58+
$scope.preciseCurrent = math.min(math.round(amount), $scope.max);
59+
}
60+
});
61+
};
62+
63+
var getPadded = function(val){
64+
return val < 10 ? ('0' + val) : val;
65+
};
66+
67+
$interval(function(){
68+
var date = new Date();
69+
var hours = date.getHours();
70+
var minutes = date.getMinutes();
71+
var seconds = date.getSeconds();
72+
73+
$scope.hours = hours;
74+
$scope.minutes = minutes;
75+
$scope.seconds = seconds;
76+
$scope.time = getPadded(hours) + ':' + getPadded(minutes) + ':' + getPadded(seconds);
77+
}, 1000);
78+
}]);

0 commit comments

Comments
 (0)