예제 #1
0
파일: field.go 프로젝트: DrJosh9000/ebiten
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
}
예제 #2
0
파일: field.go 프로젝트: hajimehoshi/ebiten
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
}