import * as PIXI from "../../pixi/pixi.mjs";

/**
 * Creates new PIXI.Sprite object from existing SpriteSheet (Atlas)
 * @param {String} source 
 * @param {PIXI.Rectangle} rectangle 
 * @returns 
 */
export function getSpriteFromAtlas(source, rectangle) {
    let texture = new PIXI.Texture({
        source: PIXI.Assets.get(source),
        frame: rectangle
    });
    return PIXI.Sprite.from(texture);
}