Новичок
-
Автор темы
- #1
[CODE = javascript] function RGB (h, s, v) {// red green blue, hue saturation value
var r, g, b, i, f, p, q, t;
i = Math.floor (h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i% 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
} [/ CODE]
So that's the main code. From that I'm trying to make a gradient that just changes between light purple to pink or dark purple, and I don't know exactly how. Can someone code the "light purple to dark purple" gradient for me and eventually explain me what he did?
This is for a onetap v4 java script btw.
var r, g, b, i, f, p, q, t;
i = Math.floor (h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i% 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
} [/ CODE]
So that's the main code. From that I'm trying to make a gradient that just changes between light purple to pink or dark purple, and I don't know exactly how. Can someone code the "light purple to dark purple" gradient for me and eventually explain me what he did?
This is for a onetap v4 java script btw.