我有纯色RGB颜色,如下所示。如何将霓虹灯发光效果应用于纯RGB颜色代码。我是新手,所以请对此表示无知。
public static final class Color {
static final float RGB_UPPER_BOUND = 255;
static final float[] GRAY_RGB = {153/RGB_UPPER_BOUND, 60/RGB_UPPER_BOUND, 243/RGB_UPPER_BOUND};
static final float[] WHITE_RGB = {255/RGB_UPPER_BOUND, 65/RGB_UPPER_BOUND, 5/RGB_UPPER_BOUND};
static final float[] BLACK_RGB = {0/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND};
static final float[] RED_RGB = {255/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND, 0/RGB_UPPER_BOUND};
static final float[] BLUE_RGB = {77/RGB_UPPER_BOUND, 77/RGB_UPPER_BOUND, 255/RGB_UPPER_BOUND};
static final float[] GREEN_RGB = {131/RGB_UPPER_BOUND, 245/RGB_UPPER_BOUND, 44/RGB_UPPER_BOUND};
public static final float[] WHITE = {
WHITE_RGB[0], WHITE_RGB[1], WHITE_RGB[2], 1.0f, // bottom left
WHITE_RGB[0], WHITE_RGB[1], WHITE_RGB[2], 1.0f, // top left
WHITE_RGB[0], WHITE_RGB[1], WHITE_RGB[2], 1.0f, // bottom right
WHITE_RGB[0], WHITE_RGB[1], WHITE_RGB[2], 1.0f, // top right
};
public static final float[] GRAY = {
GRAY_RGB[0], GRAY_RGB[1], GRAY_RGB[2], 1.0f,
GRAY_RGB[0], GRAY_RGB[1], GRAY_RGB[2], 1.0f,
GRAY_RGB[0], GRAY_RGB[1], GRAY_RGB[2], 1.0f,
GRAY_RGB[0], GRAY_RGB[1], GRAY_RGB[2], 1.0f,
};
public static final float[] BLUE = {
BLUE_RGB[0], BLUE_RGB[1], BLUE_RGB[2], 1.0f,
BLUE_RGB[0], BLUE_RGB[1], BLUE_RGB[2], 1.0f,
BLUE_RGB[0], BLUE_RGB[1], BLUE_RGB[2], 1.0f,
BLUE_RGB[0], BLUE_RGB[1], BLUE_RGB[2], 1.0f,
};
public static final float[] GREEN = {
GREEN_RGB[0], GREEN_RGB[1], GREEN_RGB[2], 1.0f,
GREEN_RGB[0], GREEN_RGB[1], GREEN_RGB[2], 1.0f,
GREEN_RGB[0], GREEN_RGB[1], GREEN_RGB[2], 1.0f,
GREEN_RGB[0], GREEN_RGB[1], GREEN_RGB[2], 1.0f,
};
}
答案 0 :(得分:0)
如果您正在寻找一个非常简单的解决方案, 转换为HSB(色调饱和度亮度)并随时间改变亮度会产生原始的发光效果。这类似于缩放RGB矢量的大小,除了因为人眼对绿光更敏感而对蓝光不太敏感,蓝色对亮度的贡献要小得多,而绿色则贡献更多!