pull/2/head
nathan wagner 2 years ago
parent ba4376ab01
commit ec1aa0ebcc

@ -104,7 +104,7 @@ func NewAnimation(sz image.Point) *Animation {
dir: image.Point{1, 1}, dir: image.Point{1, 1},
height: 8, height: 8,
width: 8, width: 8,
stroke: 16, stroke: 8,
image: images, image: images,
updown: 0, updown: 0,
} }
@ -114,13 +114,13 @@ func (a *Animation) Next() (image.Image, <-chan time.Time, error) {
defer a.updatePosition() defer a.updatePosition()
a.ctx.SetColor(color.Black) a.ctx.SetColor(color.Black)
a.ctx.Clear() a.ctx.Clear()
a.ctx.DrawCircle(float64(a.position.X), float64(a.position.Y), float64(a.stroke))
a.ctx.SetColor(color.RGBA{0, 255, 0, 255}) a.ctx.SetColor(color.RGBA{0, 255, 0, 255})
if a.dir.X == 1 { if a.dir.X == 1 {
a.ctx.DrawImageAnchored(a.image[a.updown], a.position.X, a.position.Y, 0.5, 0.5) a.ctx.DrawImageAnchored(a.image[a.updown], a.position.X, a.position.Y, 0.5, 0.5)
} 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)
} }
a.ctx.DrawCircle(float64(8), float64(8), float64(a.stroke))
//a.image = imaging.FlipH(a.image) //a.image = imaging.FlipH(a.image)
a.ctx.Fill() a.ctx.Fill()
return a.ctx.Image(), time.After(time.Millisecond * 50), nil return a.ctx.Image(), time.After(time.Millisecond * 50), nil

Loading…
Cancel
Save