Image

Published: September 03, 2019
Edited: November 06, 2020

An image texture accepts a src property that is subsequently fetched, loaded and rendered. The src property refers to an URI to an image.

Events

you can listen to texture Events to see if a image loaded successfully or not.

Example


class BasicUsageExample extends lng.Application {
    
    static _template(){
        return {
            UsingShorthand:{ x: 250, y: 100, src: '/Lightning/img/LngDocs_LilLightningIdle.png' },
            UsingTexture:{ x: 250, y: 300, texture: {type: lng.textures.ImageTexture, src: '/Lightning/img/LngDocs_LilLightningIdle.png'}}
        };
    }
}

const options = {stage: {w: window.innerWidth, h: window.innerHeight, useImageWorker: false}};
const app = new BasicUsageExample(options);
document.body.appendChild(app.stage.getCanvas());
PHP Code Snippets Powered By : XYZScripts.com