Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)
Paste
Pasted as JavaScript by autemox ( 8 years ago )
ngOnInit() {
PIXI.loader
.add([
'assets/images/chicken.png', // load sprite textures (note a TON more configurations and options not shown here)
'assets/images/chick.png' // note you do not have to use array, you can chain multiple .add('myPath') together
])
.on("progress", this.loadProgressHandler)
.load(this.setup.bind(this));
}
loadProgressHandler(loader, resource) { // handles progress for loading (optional)
console.log(`loaded ${resource.url}. Loading is ${loader.progress}% complete.`);
}
setup() { // runs when textures are done loading
const bunny:Sprite = new PIXI.Sprite(
PIXI.loader.resources['assets/images/chicken.png'].texture // create a new Sprite from an image path
);
bunny.position.set(this.app.renderer.view.width / 2, this.app.screen.height / 2); // move the sprite to the center of the screen
this.app.stage.addChild(bunny); // adds the sprite to the stage
}
Revise this Paste