<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.2.4/pixi.js"></script>
</head>
<body>
<script>
const app = new PIXI.Application({
width: window.innerWidth,
height: window.innerHeight,
transparent: true
});
globalThis.__PIXI_APP__ = app;
app.renderer.background.color = 0x23395D;
app.renderer.view.style.position = 'absolute';
document.body.appendChild(app.view);
PIXI.Loader.shared
.add('tileset', './img/tileset.png')
.load((loader, resources) => {
const texture1 = resources.tileset.texture;
const rect1 = new PIXI.Rectangle(50, 50, 76, 86);
texture1.frame = rect1;
const sprite1 = new PIXI.Sprite(texture1);
app.stage.addChild(sprite1);
});
</script>
</body>
</html>
In this code in PIXI.Loader.shared
i get
Uncaught TypeError: Cannot read properties of undefined (reading 'shared')
In Pixi.js docs this method is present, but in fact doesnt working. I also trying PIXI.loader
and other similar methods from docs but it also doesnt work. What i’m doing wrong?