| | |
| | | }; |
| | | window.addEventListener('resize', handleResize); |
| | | |
| | | // app init |
| | | app.stage.interactive = true; |
| | | app.stage.hitArea = app.screen; |
| | | globalThis.__PIXI_APP__ = app; |
| | | mapRef.current.appendChild(app.view); |
| | | setTimeout(() => { |
| | | // app init |
| | | app.stage.eventMode = 'auto'; |
| | | app.stage.hitArea = app.screen; |
| | | globalThis.__PIXI_APP__ = app; |
| | | mapRef.current.appendChild(app.view); |
| | | |
| | | // mapContainer ------------------------------ |
| | | const mapContainer = new PIXI.Container(); |
| | | mapContainer.name = "mapContainer"; |
| | | mapContainer.data = {}; |
| | | app.stage.addChild(mapContainer); |
| | | |
| | | const texture = PIXI.Texture.from('https://pixijs.com/assets/bunny.png'); |
| | | const bunny = new PIXI.Sprite(texture); |
| | | bunny.anchor.set(0.5); |
| | | console.log(app.screen); |
| | | bunny.x = app.screen.width / 2; |
| | | bunny.y = app.screen.height / 2; |
| | | |
| | | mapContainer.addChild(bunny); |
| | | |
| | | app.ticker.add((delta) => { |
| | | bunny.rotation -= 0.01 * delta; |
| | | }); |
| | | }, 300) |
| | | |
| | | }, []); |
| | | |
| | | React.useEffect(() => { |