From 34dfc8d2104613264662bfbda805d4635e128e3b Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 15 Jun 2023 04:14:53 +0000 Subject: [PATCH] slice-y --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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: