Skip to content

Commit

Permalink
Merge pull request #5 from yohamta/develop
Browse files Browse the repository at this point in the history
Add shortcut for NewAnimation
  • Loading branch information
yohamta authored Aug 8, 2022
2 parents eca27a5 + eeb8182 commit c43ab3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions animation.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ func NewAnimation(sprite *Sprite, durations interface{}, onLoop ...OnLoop) *Anim
return anim
}

// New creates a new animation from the specified image
func New(img *ebiten.Image, frames []*image.Rectangle, durations interface{}, onLoop ...OnLoop) *Animation {
spr := NewSprite(img, frames)
return NewAnimation(spr, durations, onLoop...)
}

// Clone return a copied animation object.
func (anim *Animation) Clone() *Animation {
new := *anim
Expand Down

0 comments on commit c43ab3d

Please sign in to comment.