pull/3/head
nathan 1 year ago
parent 8094030b38
commit 34dfc8d210

@ -151,12 +151,12 @@ func (a *Animation) Next() (image.Image, <-chan time.Time, error) {
} else { } else {
a.ctx.DrawImageAnchored(imaging.FlipH(a.image[a.updown]), a.position.X, a.position.Y, 0.5, 0.5) 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 { if a.countDown > 0 {
a.ctx.DrawImageAnchored(a.image[3], 0, 0, 0, 0) a.ctx.DrawImageAnchored(a.image[3], 0, 0, 0, 0)
a.countDown -= 50 a.countDown -= 50
} else { } else {
a.image[3] = nil a.image = a.image[:len(a.image)-1]
a.countDown = 5000 a.countDown = 5000
} }
} }
@ -170,7 +170,7 @@ func (a *Animation) Next() (image.Image, <-chan time.Time, error) {
} else { } else {
baseImage, _ := b64.StdEncoding.DecodeString(incoming.Image) baseImage, _ := b64.StdEncoding.DecodeString(incoming.Image)
bigImage, _, _ := image.Decode(bytes.NewReader(baseImage)) 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) a.ctx.DrawImageAnchored(a.image[3], 0, 0, 0, 0)
} }
default: default:

Loading…
Cancel
Save