diff --git a/main.go b/main.go index c3df377..0717319 100644 --- a/main.go +++ b/main.go @@ -151,12 +151,12 @@ func (a *Animation) Next() (image.Image, <-chan time.Time, error) { } else { a.ctx.DrawImageAnchored(imaging.FlipH(a.image[a.updown]), a.position.X, a.position.Y, 0.5, 0.5) } - if a.image[3] != nil { + if len(a.image) == 3 { if a.countDown > 0 { a.ctx.DrawImageAnchored(a.image[3], 0, 0, 0, 0) a.countDown -= 50 } else { - a.image[3] = nil + a.image = a.image[:len(a.image)-1] a.countDown = 5000 } } @@ -170,7 +170,7 @@ func (a *Animation) Next() (image.Image, <-chan time.Time, error) { } else { baseImage, _ := b64.StdEncoding.DecodeString(incoming.Image) bigImage, _, _ := image.Decode(bytes.NewReader(baseImage)) - a.image[3] = imaging.Resize(bigImage, 32, 32, imaging.Lanczos) + a.image = append(a.image, imaging.Resize(bigImage, 32, 32, imaging.Lanczos)) a.ctx.DrawImageAnchored(a.image[3], 0, 0, 0, 0) } default: