Based on this example, the Queue<Color>
below cycles from Color.green
to Color.blue
and back to Color.green
again in N = 32
steps. Note that Color.green
is numerically less than Color.blue
in the HSB model. See also this related example using HSB.
public Flash(JComponent component) {
this.component = component;
float gHue = Color.RGBtoHSB(0, 1, 0, null)[0];
float bHue = Color.RGBtoHSB(0, 0, 1, null)[0];
for (int i = 0; i < N; i++) {
clut.add(Color.getHSBColor(gHue + (i * (bHue - gHue) / N), 1, 1));
}
for (int i = 0; i < N; i++) {
clut.add(Color.getHSBColor(bHue - (i * (bHue - gHue) / N), 1, 1));
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…