Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async rotateFrame(frameSprite, angle) {
- // //frameSprite = new PIXI.Sprite(_LIB.app.renderer.generateTexture(frameSprite));
- // // _LIB.download.imageByRender(frameSprite);
- // // // const renderTexture = new PIXI.RenderTexture.create(frameSprite.width, frameSprite.height);
- // // // _LIB.app.renderer.render(frameSprite, renderTexture);
- // // // frameSprite = new PIXI.Sprite(renderTexture);
- // // //_LIB.TextureManager.addT(frameSprite.texture, 'Frames-rotateFrame-frameSprite', true);
- // return frameSprite;
- if (angle && !(angle % 90)) {
- const container = new PIXI.Container();
- container.addChild(frameSprite);
- container.children[0].angle = angle;
- container.children[0].x = 0;
- container.children[0].y = 0;
- let localBounds = container.getLocalBounds();
- container.children[0].x = localBounds.x * (localBounds.x < 0 ? -1 : 1);
- container.children[0].y = localBounds.y * (localBounds.y < 0 ? -1 : 1);
- // frameSprite = new PIXI.Sprite(_LIB.app.renderer.generateTexture(container));
- // _LIB.TextureManager.addT(frameSprite.texture, 'Frames-rotateFrame-frameSprite', true);
- //frameSprite = new PIXI.Sprite(new PIXI.Texture.fromBuffer(_LIB.app.renderer.extract.pixels(container), container.width, container.height));
- frameSprite = new PIXI.Sprite((await _LIB.app.addToLoader(
- 'test' + Date.now(),
- _LIB.app.renderer.extract.base64(container))).texture
- );
- if (frameSprite.width / frameSprite.height != _LIB.app.stage.width / _LIB.app.stage.height) {
- _LIB.watermark.remove(false, true);
- }
- /* frameSprite.angle += angle;
- frameSprite.position.set(frameSprite.width / 2, frameSprite.height / 2);
- frameSprite.pivot.set(frameSprite.width / 2, frameSprite.height / 2); */
- }
- console.log('EXIT: ', frameSprite);
- return frameSprite;
- }
Add Comment
Please, Sign In to add comment