lygia
/color
/hueShift
)Shifts color hue
Dependencies:
Use:
hueShift(<vec3|vec4> color, <float> angle)
#ifndef FNC_HUESHIFT
#define FNC_HUESHIFT
vec3 hueShift( vec3 color, float a){
vec3 hsl = rgb2hsl(color);
#ifndef HUESHIFT_AMOUNT
hsl.r = hsl.r * TAU + a;
hsl.r = fract(hsl.r / TAU);
#else
hsl.r += a;
#endif
return hsl2rgb(hsl);
}
vec4 hueShift(in vec4 v, in float a) {
return vec4(hueShift(v.rgb, a), v.a);
}
#endif
Dependencies:
Use:
hueShift(<float3|float4> color, <float> angle)
#ifndef FNC_HUESHIFT
#define FNC_HUESHIFT
float3 hueShift( float3 color, float a){
float3 hsl = rgb2hsl(color);
#ifndef HUESHIFT_AMOUNT
hsl.r = hsl.r * TAU + a;
hsl.r = frac(hsl.r / TAU);
#else
hsl.r += a;
#endif
return hsl2rgb(hsl);
}
float4 hueShift(in float4 v, in float a) { return float4(hueShift(v.rgb, a), v.a);}
#endif
Dependencies:
Use:
hueShift(<float3|float4> color, <float> angle)
#ifndef FNC_HUESHIFT
#define FNC_HUESHIFT
float3 hueShift( float3 color, float a){
float3 hsl = rgb2hsl(color);
#ifndef HUESHIFT_AMOUNT
hsl.r = hsl.r * TAU + a;
hsl.r = fract(hsl.r / TAU);
#else
hsl.r += a;
#endif
return hsl2rgb(hsl);
}
float4 hueShift(float4 v, float a) {
return float4(hueShift(v.rgb, a), v.a);
}
#endif
Dependencies:
Use:
<vec3f> hueShift(<vec3f> color, <float> angle)
fn hueShift(color: vec3f, a: f32 ) -> vec3f{
var hsl = rgb2hsl(color);
hsl.r = hsl.r * TAU + a;
hsl.r = fract(hsl.r / TAU);
return hsl2rgb(hsl);
}
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository