A configurable 2D camera for pixi.js v8. Try it in the playground, which shows the code for whatever you set up.
import { Application } from 'pixi.js';
import { Viewport } from 'pixi-viewport';
const app = new Application();
await app.init({ resizeTo: window });
document.body.appendChild(app.canvas);
const viewport = new Viewport({
screenWidth: app.screen.width,
screenHeight: app.screen.height,
worldWidth: 2000,
worldHeight: 2000,
events: app.renderer.events, // required for input
});
app.stage.addChild(viewport);
viewport.drag().pinch().wheel().decelerate();
Start with Viewport, then add plugins for the behavior you need:
Each plugin's options are in the Plugin options section. Events are listed on Viewport.