Improve animation GIF color

This commit is contained in:
Hajime Hoshi 2014-12-29 01:57:39 +09:00
parent 2810161cdb
commit 47214fb572
5 changed files with 14 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 KiB

After

Width:  |  Height:  |  Size: 638 KiB

View File

@ -244,7 +244,7 @@ func update(screen *ebiten.Image) error {
count++
w, h := gophersImage.Size()
geo := ebiten.TranslateGeo(-float64(w)/2, -float64(h)/2)
geo.Concat(ebiten.RotateGeo(float64(count%720) * 2 * math.Pi / 720))
geo.Concat(ebiten.RotateGeo(float64(count%360) * 2 * math.Pi / 360))
geo.Concat(ebiten.TranslateGeo(screenWidth/2, screenHeight/2))
if err := screen.DrawImage(gophersImage, &ebiten.DrawImageOptions{
GeoM: geo,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 691 KiB

View File

@ -35,15 +35,18 @@ type recorder struct {
wg sync.WaitGroup
}
var cheapPalette = color.Palette{
color.RGBA{0x00, 0x00, 0x00, 0xff},
color.RGBA{0xff, 0x00, 0x00, 0xff},
color.RGBA{0x00, 0xff, 0x00, 0xff},
color.RGBA{0x00, 0x00, 0xff, 0xff},
color.RGBA{0xff, 0xff, 0x00, 0xff},
color.RGBA{0xff, 0x00, 0xff, 0xff},
color.RGBA{0x00, 0xff, 0xff, 0xff},
color.RGBA{0xff, 0xff, 0xff, 0xff},
var cheapPalette color.Palette
func init() {
cs := []color.Color{}
for _, r := range []uint8{0x00, 0x80, 0xff} {
for _, g := range []uint8{0x00, 0x80, 0xff} {
for _, b := range []uint8{0x00, 0x80, 0xff} {
cs = append(cs, color.RGBA{r, g, b, 0xff})
}
}
}
cheapPalette = color.Palette(cs)
}
func (r *recorder) delay() int {

View File

@ -36,7 +36,7 @@ func update(screen *ebiten.Image) error {
count++
w, h := gophersImage.Size()
geo := ebiten.TranslateGeo(-float64(w)/2, -float64(h)/2)
geo.Concat(ebiten.RotateGeo(float64(count%720) * 2 * math.Pi / 720))
geo.Concat(ebiten.RotateGeo(float64(count%360) * 2 * math.Pi / 360))
geo.Concat(ebiten.TranslateGeo(screenWidth/2, screenHeight/2))
if err := screen.DrawImage(gophersImage, &ebiten.DrawImageOptions{
GeoM: geo,