Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/sprite-animated

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/sprite-animated - npm Package Compare versions

Comparing version 6.5.3 to 7.0.0-alpha

517

dist/cjs/sprite-animated.js
/*!
* @pixi/sprite-animated - v6.5.3
* Compiled Fri, 09 Sep 2022 13:55:20 UTC
* @pixi/sprite-animated - v7.0.0-alpha
* Compiled Fri, 09 Sep 2022 16:09:18 UTC
*

@@ -12,337 +12,192 @@ * @pixi/sprite-animated is licensed under the MIT License.

var sprite = require('@pixi/sprite');
var core = require('@pixi/core');
var sprite = require('@pixi/sprite');
var ticker = require('@pixi/ticker');
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
/**
* An AnimatedSprite is a simple way to display an animation depicted by a list of textures.
*
* ```js
* let alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"];
* let textureArray = [];
*
* for (let i=0; i < 4; i++)
* {
* let texture = PIXI.Texture.from(alienImages[i]);
* textureArray.push(texture);
* };
*
* let animatedSprite = new PIXI.AnimatedSprite(textureArray);
* ```
*
* The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}
* containing the animation definitions:
*
* ```js
* PIXI.Loader.shared.add("assets/spritesheet.json").load(setup);
*
* function setup() {
* let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet;
* animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]);
* ...
* }
* ```
* @memberof PIXI
*/
var AnimatedSprite = /** @class */ (function (_super) {
__extends(AnimatedSprite, _super);
/**
* @param textures - An array of {@link PIXI.Texture} or frame
* objects that make up the animation.
* @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time.
*/
function AnimatedSprite(textures, autoUpdate) {
if (autoUpdate === void 0) { autoUpdate = true; }
var _this = _super.call(this, textures[0] instanceof core.Texture ? textures[0] : textures[0].texture) || this;
_this._textures = null;
_this._durations = null;
_this._autoUpdate = autoUpdate;
_this._isConnectedToTicker = false;
_this.animationSpeed = 1;
_this.loop = true;
_this.updateAnchor = false;
_this.onComplete = null;
_this.onFrameChange = null;
_this.onLoop = null;
_this._currentTime = 0;
_this._playing = false;
_this._previousFrame = null;
_this.textures = textures;
return _this;
class AnimatedSprite extends sprite.Sprite {
constructor(textures, autoUpdate = true) {
super(textures[0] instanceof core.Texture ? textures[0] : textures[0].texture);
this._textures = null;
this._durations = null;
this._autoUpdate = autoUpdate;
this._isConnectedToTicker = false;
this.animationSpeed = 1;
this.loop = true;
this.updateAnchor = false;
this.onComplete = null;
this.onFrameChange = null;
this.onLoop = null;
this._currentTime = 0;
this._playing = false;
this._previousFrame = null;
this.textures = textures;
}
stop() {
if (!this._playing) {
return;
}
/** Stops the AnimatedSprite. */
AnimatedSprite.prototype.stop = function () {
if (!this._playing) {
return;
this._playing = false;
if (this._autoUpdate && this._isConnectedToTicker) {
core.Ticker.shared.remove(this.update, this);
this._isConnectedToTicker = false;
}
}
play() {
if (this._playing) {
return;
}
this._playing = true;
if (this._autoUpdate && !this._isConnectedToTicker) {
core.Ticker.shared.add(this.update, this, core.UPDATE_PRIORITY.HIGH);
this._isConnectedToTicker = true;
}
}
gotoAndStop(frameNumber) {
this.stop();
const previousFrame = this.currentFrame;
this._currentTime = frameNumber;
if (previousFrame !== this.currentFrame) {
this.updateTexture();
}
}
gotoAndPlay(frameNumber) {
const previousFrame = this.currentFrame;
this._currentTime = frameNumber;
if (previousFrame !== this.currentFrame) {
this.updateTexture();
}
this.play();
}
update(deltaTime) {
if (!this._playing) {
return;
}
const elapsed = this.animationSpeed * deltaTime;
const previousFrame = this.currentFrame;
if (this._durations !== null) {
let lag = this._currentTime % 1 * this._durations[this.currentFrame];
lag += elapsed / 60 * 1e3;
while (lag < 0) {
this._currentTime--;
lag += this._durations[this.currentFrame];
}
const sign = Math.sign(this.animationSpeed * deltaTime);
this._currentTime = Math.floor(this._currentTime);
while (lag >= this._durations[this.currentFrame]) {
lag -= this._durations[this.currentFrame] * sign;
this._currentTime += sign;
}
this._currentTime += lag / this._durations[this.currentFrame];
} else {
this._currentTime += elapsed;
}
if (this._currentTime < 0 && !this.loop) {
this.gotoAndStop(0);
if (this.onComplete) {
this.onComplete();
}
} else if (this._currentTime >= this._textures.length && !this.loop) {
this.gotoAndStop(this._textures.length - 1);
if (this.onComplete) {
this.onComplete();
}
} else if (previousFrame !== this.currentFrame) {
if (this.loop && this.onLoop) {
if (this.animationSpeed > 0 && this.currentFrame < previousFrame) {
this.onLoop();
} else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) {
this.onLoop();
}
this._playing = false;
if (this._autoUpdate && this._isConnectedToTicker) {
ticker.Ticker.shared.remove(this.update, this);
this._isConnectedToTicker = false;
}
};
/** Plays the AnimatedSprite. */
AnimatedSprite.prototype.play = function () {
if (this._playing) {
return;
}
this._playing = true;
if (this._autoUpdate && !this._isConnectedToTicker) {
ticker.Ticker.shared.add(this.update, this, ticker.UPDATE_PRIORITY.HIGH);
this._isConnectedToTicker = true;
}
};
/**
* Stops the AnimatedSprite and goes to a specific frame.
* @param frameNumber - Frame index to stop at.
*/
AnimatedSprite.prototype.gotoAndStop = function (frameNumber) {
this.stop();
var previousFrame = this.currentFrame;
this._currentTime = frameNumber;
if (previousFrame !== this.currentFrame) {
this.updateTexture();
}
};
/**
* Goes to a specific frame and begins playing the AnimatedSprite.
* @param frameNumber - Frame index to start at.
*/
AnimatedSprite.prototype.gotoAndPlay = function (frameNumber) {
var previousFrame = this.currentFrame;
this._currentTime = frameNumber;
if (previousFrame !== this.currentFrame) {
this.updateTexture();
}
this.play();
};
/**
* Updates the object transform for rendering.
* @param deltaTime - Time since last tick.
*/
AnimatedSprite.prototype.update = function (deltaTime) {
if (!this._playing) {
return;
}
var elapsed = this.animationSpeed * deltaTime;
var previousFrame = this.currentFrame;
if (this._durations !== null) {
var lag = this._currentTime % 1 * this._durations[this.currentFrame];
lag += elapsed / 60 * 1000;
while (lag < 0) {
this._currentTime--;
lag += this._durations[this.currentFrame];
}
var sign = Math.sign(this.animationSpeed * deltaTime);
this._currentTime = Math.floor(this._currentTime);
while (lag >= this._durations[this.currentFrame]) {
lag -= this._durations[this.currentFrame] * sign;
this._currentTime += sign;
}
this._currentTime += lag / this._durations[this.currentFrame];
}
else {
this._currentTime += elapsed;
}
if (this._currentTime < 0 && !this.loop) {
this.gotoAndStop(0);
if (this.onComplete) {
this.onComplete();
}
}
else if (this._currentTime >= this._textures.length && !this.loop) {
this.gotoAndStop(this._textures.length - 1);
if (this.onComplete) {
this.onComplete();
}
}
else if (previousFrame !== this.currentFrame) {
if (this.loop && this.onLoop) {
if (this.animationSpeed > 0 && this.currentFrame < previousFrame) {
this.onLoop();
}
else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) {
this.onLoop();
}
}
this.updateTexture();
}
};
/** Updates the displayed texture to match the current frame index. */
AnimatedSprite.prototype.updateTexture = function () {
var currentFrame = this.currentFrame;
if (this._previousFrame === currentFrame) {
return;
}
this._previousFrame = currentFrame;
this._texture = this._textures[currentFrame];
this._textureID = -1;
this._textureTrimmedID = -1;
this._cachedTint = 0xFFFFFF;
this.uvs = this._texture._uvs.uvsFloat32;
if (this.updateAnchor) {
this._anchor.copyFrom(this._texture.defaultAnchor);
}
if (this.onFrameChange) {
this.onFrameChange(this.currentFrame);
}
};
/**
* Stops the AnimatedSprite and destroys it.
* @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
* have been set to that value.
* @param {boolean} [options.children=false] - If set to true, all the children will have their destroy
* method called as well. 'options' will be passed on to those calls.
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.
* @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.
*/
AnimatedSprite.prototype.destroy = function (options) {
this.stop();
_super.prototype.destroy.call(this, options);
this.onComplete = null;
this.onFrameChange = null;
this.onLoop = null;
};
/**
* A short hand way of creating an AnimatedSprite from an array of frame ids.
* @param frames - The array of frames ids the AnimatedSprite will use as its texture frames.
* @returns - The new animated sprite with the specified frames.
*/
AnimatedSprite.fromFrames = function (frames) {
var textures = [];
for (var i = 0; i < frames.length; ++i) {
textures.push(core.Texture.from(frames[i]));
}
return new AnimatedSprite(textures);
};
/**
* A short hand way of creating an AnimatedSprite from an array of image ids.
* @param images - The array of image urls the AnimatedSprite will use as its texture frames.
* @returns The new animate sprite with the specified images as frames.
*/
AnimatedSprite.fromImages = function (images) {
var textures = [];
for (var i = 0; i < images.length; ++i) {
textures.push(core.Texture.from(images[i]));
}
return new AnimatedSprite(textures);
};
Object.defineProperty(AnimatedSprite.prototype, "totalFrames", {
/**
* The total number of frames in the AnimatedSprite. This is the same as number of textures
* assigned to the AnimatedSprite.
* @readonly
* @default 0
*/
get: function () {
return this._textures.length;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimatedSprite.prototype, "textures", {
/** The array of textures used for this AnimatedSprite. */
get: function () {
return this._textures;
},
set: function (value) {
if (value[0] instanceof core.Texture) {
this._textures = value;
this._durations = null;
}
else {
this._textures = [];
this._durations = [];
for (var i = 0; i < value.length; i++) {
this._textures.push(value[i].texture);
this._durations.push(value[i].time);
}
}
this._previousFrame = null;
this.gotoAndStop(0);
this.updateTexture();
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimatedSprite.prototype, "currentFrame", {
/**
* The AnimatedSprites current frame index.
* @readonly
*/
get: function () {
var currentFrame = Math.floor(this._currentTime) % this._textures.length;
if (currentFrame < 0) {
currentFrame += this._textures.length;
}
return currentFrame;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimatedSprite.prototype, "playing", {
/**
* Indicates if the AnimatedSprite is currently playing.
* @readonly
*/
get: function () {
return this._playing;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AnimatedSprite.prototype, "autoUpdate", {
/** Whether to use PIXI.Ticker.shared to auto update animation time. */
get: function () {
return this._autoUpdate;
},
set: function (value) {
if (value !== this._autoUpdate) {
this._autoUpdate = value;
if (!this._autoUpdate && this._isConnectedToTicker) {
ticker.Ticker.shared.remove(this.update, this);
this._isConnectedToTicker = false;
}
else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) {
ticker.Ticker.shared.add(this.update, this);
this._isConnectedToTicker = true;
}
}
},
enumerable: false,
configurable: true
});
return AnimatedSprite;
}(sprite.Sprite));
}
this.updateTexture();
}
}
updateTexture() {
const currentFrame = this.currentFrame;
if (this._previousFrame === currentFrame) {
return;
}
this._previousFrame = currentFrame;
this._texture = this._textures[currentFrame];
this._textureID = -1;
this._textureTrimmedID = -1;
this._cachedTint = 16777215;
this.uvs = this._texture._uvs.uvsFloat32;
if (this.updateAnchor) {
this._anchor.copyFrom(this._texture.defaultAnchor);
}
if (this.onFrameChange) {
this.onFrameChange(this.currentFrame);
}
}
destroy(options) {
this.stop();
super.destroy(options);
this.onComplete = null;
this.onFrameChange = null;
this.onLoop = null;
}
static fromFrames(frames) {
const textures = [];
for (let i = 0; i < frames.length; ++i) {
textures.push(core.Texture.from(frames[i]));
}
return new AnimatedSprite(textures);
}
static fromImages(images) {
const textures = [];
for (let i = 0; i < images.length; ++i) {
textures.push(core.Texture.from(images[i]));
}
return new AnimatedSprite(textures);
}
get totalFrames() {
return this._textures.length;
}
get textures() {
return this._textures;
}
set textures(value) {
if (value[0] instanceof core.Texture) {
this._textures = value;
this._durations = null;
} else {
this._textures = [];
this._durations = [];
for (let i = 0; i < value.length; i++) {
this._textures.push(value[i].texture);
this._durations.push(value[i].time);
}
}
this._previousFrame = null;
this.gotoAndStop(0);
this.updateTexture();
}
get currentFrame() {
let currentFrame = Math.floor(this._currentTime) % this._textures.length;
if (currentFrame < 0) {
currentFrame += this._textures.length;
}
return currentFrame;
}
get playing() {
return this._playing;
}
get autoUpdate() {
return this._autoUpdate;
}
set autoUpdate(value) {
if (value !== this._autoUpdate) {
this._autoUpdate = value;
if (!this._autoUpdate && this._isConnectedToTicker) {
core.Ticker.shared.remove(this.update, this);
this._isConnectedToTicker = false;
} else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) {
core.Ticker.shared.add(this.update, this);
this._isConnectedToTicker = true;
}
}
}
}
exports.AnimatedSprite = AnimatedSprite;
//# sourceMappingURL=sprite-animated.js.map

@@ -1,9 +0,8 @@

/*!
* @pixi/sprite-animated - v6.5.3
* Compiled Fri, 09 Sep 2022 13:55:20 UTC
"use strict";/*!
* @pixi/sprite-animated - v7.0.0-alpha
* Compiled Fri, 09 Sep 2022 16:09:18 UTC
*
* @pixi/sprite-animated is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@pixi/core"),e=require("@pixi/sprite"),r=require("@pixi/ticker"),i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},i(t,e)};var n=function(e){function n(r,i){void 0===i&&(i=!0);var n=e.call(this,r[0]instanceof t.Texture?r[0]:r[0].texture)||this;return n._textures=null,n._durations=null,n._autoUpdate=i,n._isConnectedToTicker=!1,n.animationSpeed=1,n.loop=!0,n.updateAnchor=!1,n.onComplete=null,n.onFrameChange=null,n.onLoop=null,n._currentTime=0,n._playing=!1,n._previousFrame=null,n.textures=r,n}return function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(n,e),n.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(r.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1))},n.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(r.Ticker.shared.add(this.update,this,r.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},n.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},n.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},n.prototype.update=function(t){if(this._playing){var e=this.animationSpeed*t,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=e/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<r||this.animationSpeed<0&&this.currentFrame>r)&&this.onLoop(),this.updateTexture())}},n.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},n.prototype.destroy=function(t){this.stop(),e.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},n.fromFrames=function(e){for(var r=[],i=0;i<e.length;++i)r.push(t.Texture.from(e[i]));return new n(r)},n.fromImages=function(e){for(var r=[],i=0;i<e.length;++i)r.push(t.Texture.from(e[i]));return new n(r)},Object.defineProperty(n.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textures",{get:function(){return this._textures},set:function(e){if(e[0]instanceof t.Texture)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(var r=0;r<e.length;r++)this._textures.push(e[r].texture),this._durations.push(e[r].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(r.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(r.Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),n}(e.Sprite);exports.AnimatedSprite=n;
*/Object.defineProperty(exports,"__esModule",{value:!0});var o=require("@pixi/sprite"),s=require("@pixi/core");class h extends o.Sprite{constructor(t,e=!0){super(t[0]instanceof s.Texture?t[0]:t[0].texture),this._textures=null,this._durations=null,this._autoUpdate=e,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=t}stop(){!this._playing||(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(s.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(s.Ticker.shared.add(this.update,this,s.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop();const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}gotoAndPlay(t){const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()}update(t){if(!this._playing)return;const e=this.animationSpeed*t,i=this.currentFrame;if(this._durations!==null){let r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];const n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i?this.onLoop():this.animationSpeed<0&&this.currentFrame>i&&this.onLoop()),this.updateTexture())}updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;i<t.length;++i)e.push(s.Texture.from(t[i]));return new h(e)}static fromImages(t){const e=[];for(let i=0;i<t.length;++i)e.push(s.Texture.from(t[i]));return new h(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof s.Texture)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(s.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(s.Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))}}exports.AnimatedSprite=h;
//# sourceMappingURL=sprite-animated.min.js.map
{
"name": "@pixi/sprite-animated",
"version": "6.5.3",
"version": "7.0.0-alpha",
"main": "dist/cjs/sprite-animated.js",
"module": "dist/esm/sprite-animated.mjs",
"bundle": "dist/browser/sprite-animated.js",
"types": "index.d.ts",

@@ -36,12 +35,10 @@ "exports": {

"files": [
"lib",
"dist",
"*.d.ts"
],
"peerDependencies": {
"@pixi/core": "6.5.3",
"@pixi/sprite": "6.5.3",
"@pixi/ticker": "6.5.3"
},
"gitHead": "28e6b2841a65837a5e2873a3d5a9c27cabbe795a"
"pixiRequirements": [
"@pixi/core",
"@pixi/sprite"
],
"gitHead": "da993226df64b804a9c00ed9ee4d011191467b8a"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc