kvp0 Posted April 1 Share Posted April 1 hi everyone. i am trying to render a single sprite, just to see if i can get this library working so i can then transition a bigger project to using it. i am using webpack. not getting any errors in chrome and really lost on what im doing wrong. heres my code: import * as PIXI from 'pixi.js' import { roomSceneManifest } from './image_imports.js' async function loadAssets (){ const app = new PIXI.Application() await app.init({ width: 800, height: 600 }); document.body.appendChild(app.canvas); PIXI.Assets.init({manifest: roomSceneManifest}) const assets = await PIXI.Assets.loadBundle('png'); console.log(assets) const bg = PIXI.Sprite.from(assets.BackgroundImg); console.log(bg) bg.anchor.set(0.5); bg.x = app.screen.width / 2; bg.y = app.screen.height / 2; app.stage.addChild(bg); } loadAssets() ./image_imports.js export const roomSceneManifest = { "bundles":[ { "name":"png", "assets":[ { "alias":"BackgroundImg", "src":BackgroundImg } ] } ] } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.