🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

github.com/wGAME9/animation

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
a

github.com/wGAME9/animation

v0.0.0-20240516030551-99b371723cc2
100

Supply Chain Security

100

Vulnerability

100

Quality

100

Maintenance

100

License

Version published
Created
Issues
0

Animation

My implementation of drawing animation for ebitengine. Currently only support drawing line.

Example:

package main

import (
	"image/color"
	"log"

	"github.com/wGAME9/animation/animation"

	"github.com/hajimehoshi/ebiten/v2"
)

const (
	screenWidth  = 640
	screenHeight = 480
)

var (
	colorWhite = color.White
	colorBlue  = color.RGBA{0, 0, 255, 255}
)

type Game struct {
	line   animation.Animation
}

func (g *Game) Update() error {
	g.line.Update()

	return nil
}

func (g *Game) Draw(screen *ebiten.Image) {
	screen.Fill(colorWhite)

	screen.DrawImage(g.line.Image(), &ebiten.DrawImageOptions{})
}
func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
	return screenWidth, screenHeight
}

func main() {
	ebiten.SetWindowSize(screenWidth, screenHeight)
	ebiten.SetWindowTitle("Drawing Animation.")

	game := &Game{
		line: animation.NewLine(
			animation.Point{X: 10, Y: 10},
			animation.Point{X: 300, Y: 300},
			10,
			2,
			colorBlue,
			true,
		),
	}

	if err := ebiten.RunGame(game); err != nil {
		log.Fatal(err)
	}
}

FAQs

Package last updated on 16 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts