Camera package for Ebitengine.
import "github.com/setanarut/kamera/v2"
- Camera shake effect with fastnoise library noise types.
- Smooth camera movement with three interpolation modes:
None
: Direct camera movement without smoothingLerp
: Linear interpolation for smooth transitionsSmoothDamp
: Spring-like motion with acceleration and deceleration and maximum speed.
- Rotate/Zoom
A pseudo code:
func (g *Game) Update() error {
g.MainCamera.LookAt(player.X, player.Y)
// Apply all world-space `playerDrawImageOptions.GeoM{}` transform here
}
func (g *Game) Draw(screen *ebiten.Image) {
g.MainCamera.Draw(playerImage, playerDrawImageOptions, screen)
}
Run platformer example on your local machine
go run github.com/setanarut/kamera/v2/examples/platformer@latest
Run director example on your local machine
go run github.com/setanarut/kamera/v2/examples/director@latest