Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
A sprite that follows the mouse pointer.
# pixijs/demo/interactive_sprite.html
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.2.4/pixi.min.js"></script>
</head>
<body>
<script>
const app = new PIXI.Application({ width: 800, height: 600 });
document.body.appendChild(app.view);
const sprite = PIXI.Sprite.from('https://pixijs.io/examples/examples/assets/bunny.png');
sprite.anchor.set(0.5);
app.stage.addChild(sprite);
app.stage.interactive = true;
app.stage.on('pointermove', (e) => {
const pos = e.data.global;
sprite.x = pos.x;
sprite.y = pos.y;
});
</script>
</body>
</html>PixiJS is a fast, 2D rendering JavaScript library that leverages WebGL (with canvas fallback) to create interactive graphics, games, and applications for the web. It offers a high-performance API for sprites, textures, filters, and animations.
Origin & Creator
PixiJS was created by Mat Groves in 2013 and is maintained by the PixiJS team and community contributors.
Industrial Note
PixiJS is widely used in 2D web games, interactive experiences, data visualizations, advertising banners, HTML5 games, and creative web apps requiring fast, GPU-accelerated rendering.