-
Notifications
You must be signed in to change notification settings - Fork 0
/
Colores.js
54 lines (46 loc) · 1.61 KB
/
Colores.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
function obtenerListaTeclasTintasFondo() {
let teclas = [];
for (let tinta of tintasFondo) {
teclas.push(tinta.teclas);
}
return teclas;
}
function obtenerListaTeclasTintasPincel() {
let teclas = [];
for (let tinta of tintasPincel) {
teclas.push(tinta.teclas);
}
return teclas;
}
function cargarColores(p) {
tintasFondo.push(new Tinta(p, 0, "BL", ['Z', 'z'], '#FFFFFF'));
tintasFondo.push(new Tinta(p, 1, "NG", ['X', 'x'], '#000000'));
tintasFondo.push(new Tinta(p, 2, "PR", ['C', 'c'], '#B136FF'));
tintasFondo.push(new Tinta(p, 3, "NJ", ['V', 'v'], '#FFB236'));
tintasPincel.push(new Tinta(p, 0, "NG", ['A', 'a'], '#171717'));
tintasPincel.push(new Tinta(p, 1, "BL", ['S', 's'], '#F7F7F7'));
tintasPincel.push(new Tinta(p, 2, "RJ", ['D', 'd'], '#EA8879'));
tintasPincel.push(new Tinta(p, 3, "VR", ['F', 'f'], '#A6EA6B'));
tintasPincel.push(new Tinta(p, 4, "AZ", ['G', 'g'], '#2E86F0'));
tintasPincel.push(new Tinta(p, 5, "PR", ['H', 'h'], '#B136FF'));
}
var Tinta = function(p, indice, name, teclas, c) {
this.p = p;
this.indice = indice;
this.nombre = name;
this.teclas = teclas;
this.rojo = p.red(c);
this.verde = p.green(c);
this.azul = p.blue(c);
}
Tinta.prototype = {
generarColor: function(opacidad = 255) {
return this.p.color(this.rojo, this.verde, this.azul, opacidad);
},
generarColorComplementario: function(opacidad=255) {
return this.p.color(255 - this.rojo, 255 - this.verde, 255 - this.azul, opacidad);
},
interpolarHacia: function(destino, factor) {
return this.p.lerpColor(this.generarColor(), destino.generarColor(), factor);
}
}