代码拉取完成,页面将自动刷新
/**
* @class SpriteAnimationClip
*/
/**
* @namespace SpriteAnimationClip
*/
/**
* @class WrapMode
* @static
*/
var WrapMode = Fire.defineEnum({
/**
* @property Default
* @type {number}
*/
Default: -1,
/**
* @property Once
* @type {number}
*/
Once: -1,
/**
* @property Loop
* @type {number}
*/
Loop: -1,
/**
* @property PingPong
* @type {number}
*/
PingPong: -1,
/**
* @property ClampForever
* @type {number}
*/
ClampForever: -1
});
/**
* @class StopAction
* @static
*/
var StopAction = Fire.defineEnum({
/**
* Do nothing
* @property DoNothing
* @type {number}
*/
DoNothing: -1,
/**
* Set to default sprite when the sprite animation stopped
* @property DefaultSprite
* @type {number}
*/
DefaultSprite: 1,
/**
* Hide the sprite when the sprite animation stopped
* @property Hide
* @type {number}
*/
Hide: -1,
/**
* Destroy the entity the sprite belongs to when the sprite animation stopped
* @property Destroy
* @type {number}
*/
Destroy: -1
});
// ------------------------------------------------------------------
/// The structure to descrip a frame in the sprite animation clip
// ------------------------------------------------------------------
var FrameInfo = Fire.define('FrameInfo')
.prop('sprite', null, Fire.ObjectType(Fire.Sprite))
.prop('frames', 0, Fire.Integer_Obsoleted);
/**
* The sprite animation clip.
* @class SpriteAnimationClip
* @extends CustomAsset
* @constructor
*/
var SpriteAnimationClip = Fire.Class({
name: 'Fire.SpriteAnimationClip',
//
extends: Fire.CustomAsset,
//
constructor: function() {
// the array of the end frame of each frame info
this._frameInfoFrames = null;
},
//
properties: {
/**
* Default wrap mode.
* @property wrapMode
* @type {SpriteAnimationClip.WrapMode}
* @default SpriteAnimationClip.WrapMode.Default
*/
wrapMode: {
default: WrapMode.Default,
type: WrapMode
},
/**
* The default type of action used when the animation stopped.
* @property stopAction
* @type {SpriteAnimationClip.StopAction}
* @default SpriteAnimationClip.StopAction.DoNothing
*/
stopAction: {
default: StopAction.DoNothing,
type: StopAction
},
/**
* The default speed of the animation clip.
* @property speed
* @type {number}
* @default 1
*/
speed: 1,
//
_frameRate: 60,
/**
* The sample rate used in this animation clip.
* @property frameRate
* @type {number}
* @default 60
*/
frameRate: {
get: function() {
return this._frameRate;
},
set: function() {
if (value !== this._frameRate) {
this._frameRate = Math.round(Math.max(value, 1));
}
}
},
/**
* The frame infos in the sprite animation clips.
* are array of {sprite: Sprite, frames: Sustained_how_many_frames}
* @property frameInfos
* @type {object[]}
* @default []
*/
frameInfos:{
default: [],
type: FrameInfo
}
},
//
getTotalFrames: function() {
var frames = 0;
for (var i = 0; i < this.frameInfos.length; ++i) {
frames += this.frameInfos[i].frames;
}
return frames;
},
//
getFrameInfoFrames: function() {
if (this._frameInfoFrames === null) {
this._frameInfoFrames = new Array(this.frameInfos.length);
var totalFrames = 0;
for (var i = 0; i < this.frameInfos.length; ++i) {
totalFrames += this.frameInfos[i].frames;
this._frameInfoFrames[i] = totalFrames;
}
}
return this._frameInfoFrames;
}
});
SpriteAnimationClip.WrapMode = WrapMode;
SpriteAnimationClip.StopAction = StopAction;
Fire.addCustomAssetMenu(SpriteAnimationClip, "New Sprite Animation");
Fire.SpriteAnimationClip = SpriteAnimationClip;
module.exports = SpriteAnimationClip;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。