mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
You can now specify a defaultTextureKey
for animation configurations, to avoid having it inside of every frame object.
This commit is contained in:
parent
15825eacb3
commit
bca6bd692e
2 changed files with 5 additions and 4 deletions
|
@ -25,7 +25,7 @@ var Animation = new Class({
|
|||
this.type = 'frame';
|
||||
|
||||
// Extract all the frame data into the frames array
|
||||
this.frames = GetFrames(manager.textureManager, GetValue(config, 'frames', []));
|
||||
this.frames = GetFrames(manager.textureManager, GetValue(config, 'frames', []), GetValue(config, 'defaultTextureKey', null));
|
||||
|
||||
// The frame rate of playback in frames per second (default 24 if duration is null)
|
||||
this.frameRate = GetValue(config, 'frameRate', null);
|
||||
|
|
|
@ -12,7 +12,7 @@ var GetValue = require('../../../utils/object/GetValue');
|
|||
*
|
||||
* @return {Phaser.Animations.AnimationFrame[]} [description]
|
||||
*/
|
||||
var GetFrames = function (textureManager, frames)
|
||||
var GetFrames = function (textureManager, frames, defaultTextureKey)
|
||||
{
|
||||
// frames: [
|
||||
// { key: textureKey, frame: textureFrame },
|
||||
|
@ -38,7 +38,8 @@ var GetFrames = function (textureManager, frames)
|
|||
|
||||
frames = [];
|
||||
|
||||
frameKeys.forEach(function (idx, value) {
|
||||
frameKeys.forEach(function (idx, value)
|
||||
{
|
||||
frames.push({ key: textureKey, frame: value });
|
||||
});
|
||||
}
|
||||
|
@ -54,7 +55,7 @@ var GetFrames = function (textureManager, frames)
|
|||
{
|
||||
var item = frames[i];
|
||||
|
||||
var key = GetValue(item, 'key', null);
|
||||
var key = GetValue(item, 'key', defaultTextureKey);
|
||||
|
||||
if (!key)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue