mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
Improve animation GIF color
This commit is contained in:
parent
2810161cdb
commit
47214fb572
Binary file not shown.
Before Width: | Height: | Size: 561 KiB After Width: | Height: | Size: 638 KiB |
@ -244,7 +244,7 @@ func update(screen *ebiten.Image) error {
|
|||||||
count++
|
count++
|
||||||
w, h := gophersImage.Size()
|
w, h := gophersImage.Size()
|
||||||
geo := ebiten.TranslateGeo(-float64(w)/2, -float64(h)/2)
|
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))
|
geo.Concat(ebiten.TranslateGeo(screenWidth/2, screenHeight/2))
|
||||||
if err := screen.DrawImage(gophersImage, &ebiten.DrawImageOptions{
|
if err := screen.DrawImage(gophersImage, &ebiten.DrawImageOptions{
|
||||||
GeoM: geo,
|
GeoM: geo,
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 691 KiB |
@ -35,15 +35,18 @@ type recorder struct {
|
|||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
var cheapPalette = color.Palette{
|
var cheapPalette color.Palette
|
||||||
color.RGBA{0x00, 0x00, 0x00, 0xff},
|
|
||||||
color.RGBA{0xff, 0x00, 0x00, 0xff},
|
func init() {
|
||||||
color.RGBA{0x00, 0xff, 0x00, 0xff},
|
cs := []color.Color{}
|
||||||
color.RGBA{0x00, 0x00, 0xff, 0xff},
|
for _, r := range []uint8{0x00, 0x80, 0xff} {
|
||||||
color.RGBA{0xff, 0xff, 0x00, 0xff},
|
for _, g := range []uint8{0x00, 0x80, 0xff} {
|
||||||
color.RGBA{0xff, 0x00, 0xff, 0xff},
|
for _, b := range []uint8{0x00, 0x80, 0xff} {
|
||||||
color.RGBA{0x00, 0xff, 0xff, 0xff},
|
cs = append(cs, color.RGBA{r, g, b, 0xff})
|
||||||
color.RGBA{0xff, 0xff, 0xff, 0xff},
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cheapPalette = color.Palette(cs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *recorder) delay() int {
|
func (r *recorder) delay() int {
|
||||||
|
@ -36,7 +36,7 @@ func update(screen *ebiten.Image) error {
|
|||||||
count++
|
count++
|
||||||
w, h := gophersImage.Size()
|
w, h := gophersImage.Size()
|
||||||
geo := ebiten.TranslateGeo(-float64(w)/2, -float64(h)/2)
|
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))
|
geo.Concat(ebiten.TranslateGeo(screenWidth/2, screenHeight/2))
|
||||||
if err := screen.DrawImage(gophersImage, &ebiten.DrawImageOptions{
|
if err := screen.DrawImage(gophersImage, &ebiten.DrawImageOptions{
|
||||||
GeoM: geo,
|
GeoM: geo,
|
||||||
|
Loading…
Reference in New Issue
Block a user