forked from rendro/vintageJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vintage.presets.js
104 lines (104 loc) · 2.1 KB
/
vintage.presets.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
var vintagePresets = {
/**
* Basic vintage effect
*/
vintage: {
curves: (function() {
var rgb = function (x) {
return -12 * Math.sin( x * 2 * Math.PI / 255 ) + x;
},
r = function(x) {
return -0.2 * Math.pow(255 * x, 0.5) * Math.sin(Math.PI * (-0.0000195 * Math.pow(x, 2) + 0.0125 * x ) ) + x;
},
g = function(x) {
return -0.001045244139166791 * Math.pow(x,2) + 1.2665372554875318 * x;
},
b = function(x) {
return 0.57254902 * x + 53;
},
c = {r:[],g:[],b:[]};
for(var i=0;i<=255;++i) {
c.r[i] = r( rgb(i) );
c.g[i] = g( rgb(i) );
c.b[i] = b( rgb(i) );
}
return c;
})(),
screen: {
r: 227,
g: 12,
b: 169,
a: 0.15
},
vignette: 0.7,
viewFinder: false // or path to image 'img/viewfinder.jpg'
},
/**
* Sepia effect
*/
sepia: {
curves: (function() {
var rgb = function (x) {
return -12 * Math.sin( x * 2 * Math.PI / 255 ) + x;
},
c = {r:[],g:[],b:[]};
for(var i=0;i<=255;++i) {
c.r[i] = rgb(i);
c.g[i] = rgb(i);
c.b[i] = rgb(i);
}
return c;
})(),
sepia: true
},
/**
* Greenish effect
*/
greenish: {
curves: (function() {
var rgb = function (x) {
return -12 * Math.sin( x * 2 * Math.PI / 255 ) + x;
},
c = {r:[],g:[],b:[]};
for(var i=0;i<=255;++i) {
c.r[i] = rgb(i);
c.g[i] = rgb(i);
c.b[i] = rgb(i);
}
return c;
})(),
vignette: 0.6,
lighten: 0.1,
screen: {
r: 255,
g: 255,
b: 0,
a: 0.15
}
},
/**
* Reddish effect
*/
reddish: {
curves: (function() {
var rgb = function (x) {
return -12 * Math.sin( x * 2 * Math.PI / 255 ) + x;
},
c = {r:[],g:[],b:[]};
for(var i=0;i<=255;++i) {
c.r[i] = rgb(i);
c.g[i] = rgb(i);
c.b[i] = rgb(i);
}
return c;
})(),
vignette: 0.6,
lighten: 0.1,
screen: {
r: 255,
g: 0,
b: 0,
a: 0.15
}
}
};