-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.js
71 lines (68 loc) · 1.58 KB
/
edit.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var filterdude = document.getElementById("filterdude");
var output = document.getElementById("filterValue");
var blurAmount = 0;
var brightness = 100;
var contrast = 100;
var dropShadow = 0;
var grayscale = 0;
var hueRotate = 0;
var invert = 0;
var opacity = 100;
var saturate = 100;
var sepia = 0;
var setOutput = function(value){
output.innerHTML = value;
}
var filterText = function() {
return "sepia(" + sepia + "%) invert(" + invert +
"%) saturate(" + saturate + "%) hue-rotate(" + hueRotate + "deg) contrast(" + contrast +
"%) grayscale(" + grayscale + "%) brightness(" + brightness + "%) blur(" + blurAmount + "px) opacity(" + opacity + "%)"
}
var setFilter = function() {
filterdude.setAttribute("style", "-webkit-filter: " + filterText());
setOutput(filterText());
}
var changeGrayscale = function(value){
grayscale = value;
setFilter();
}
var changeBlurAmount = function(value){
blurAmount = value;
setFilter();
}
var changeBrightness = function(value){
brightness = value;
setFilter();
}
var changeContrast = function(value){
contrast = value;
setFilter();
}
var changeHueRotate = function(value){
hueRotate = value;
setFilter();
}
var changeSepia = function(value){
sepia = value;
setFilter();
}
var changeInvert = function(value){
invert = value;
setFilter();
}
var changeSaturate = function(value){
saturate = value;
setFilter();
}
var changeSaturate = function(value){
saturate = value;
setFilter();
}
var changeOpacity = function(value){
opacity = value;
setFilter();
}
var changeBlur = function(value){
blurAmount = value;
setFilter();
}