-
Notifications
You must be signed in to change notification settings - Fork 0
/
gradient.js
51 lines (44 loc) · 1.27 KB
/
gradient.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var app = angular.module('gradientApp', []);
app.controller('mainCtrl', ['$scope','gradientService',function($scope,gradientService) {
$scope.option = {
color1 : '#c62828',
color2 : '#fded86',
midColor : '',
// midColorPosition : .5,
n : 10,
group : ""
}
$scope.GenerateColor = function(){
if($scope.option.midColor === null || $scope.option.midColor === '' ){
$scope.colorsHSV = gradientService.HSVGradient([
$scope.option.color1,
$scope.option.color2,
],$scope.option.n);
$scope.colorsRGB = gradientService.RGBGradient([
$scope.option.color1,
$scope.option.color2,
],$scope.option.n);
}
else{
$scope.colorsHSV = gradientService.HSVGradient([
$scope.option.color1,
$scope.option.midColor,
$scope.option.color2,
],$scope.option.n);
$scope.colorsRGB = gradientService.RGBGradient([
$scope.option.color1,
$scope.option.midColor,
$scope.option.color2,
],$scope.option.n);
}
}
// $scope.colors = gradientService.HSVGradient([{color: 'red', pos: 0},
// {color: 'blue', pos: 0.5},
// {color: 'green', pos: 1}],20);
$scope.getStyleRGB = function(i){
return {'background' : $scope.colorsRGB[i]};
}
$scope.getStyleHSV = function(i){
return {'background' : $scope.colorsHSV[i]};
}
}]);