Answers for "pixi display image"

2

pixi display image

// create a PIXI sprite from an image path
var hawaii = PIXI.Sprite.fromImage('https://crossorigin.me/https://s3-us-west-2.amazonaws.com/s.cdpn.io/107366/img_landscape.jpg');
 
// center the sprite anchor point
hawaii.anchor.x = 0;
hawaii.anchor.y = 0;
 
// move the sprite to the center of the canvas
hawaii.position.x = 200;
hawaii.position.y = 200;
 
stage.addChild(hawaii);
Posted by: Guest on March-28-2022

Browse Popular Code Answers by Language