Exemplo n.º 1
0
func (f *Field) flushingColor() ebiten.ColorM {
	clr := ebiten.ColorM{}
	alpha := (float64(f.flushCount) / maxFlushCount) / 2
	clr.Concat(ebiten.ScaleColor(1, 1, 1, alpha))
	r := (1 - float64(f.flushCount)/maxFlushCount) * 2
	g := (1 - float64(f.flushCount)/maxFlushCount) / 2
	b := (1 - float64(f.flushCount)/maxFlushCount) / 2
	clr.Concat(ebiten.TranslateColor(r, g, b, 0))
	return clr
}
Exemplo n.º 2
0
func (f *Field) flushingColor() ebiten.ColorM {
	c := f.flushCount
	if c < 0 {
		c = 0
	}
	rate := float64(c) / maxFlushCount
	clr := ebiten.ColorM{}
	alpha := min(1, rate*2)
	clr.Scale(1, 1, 1, alpha)
	r := min(1, (1-rate)*2)
	clr.Translate(r, 0, 0, 0)
	return clr
}