/
GetTweens.js
42 lines (36 loc) · 990 Bytes
/
GetTweens.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var GetValue = require('../../utils/object/GetValue');
/**
* Internal function used by the Timeline Builder.
*
* It returns an array of all tweens in the given timeline config.
*
* @function Phaser.Tweens.Builders.GetTweens
* @since 3.0.0
*
* @param {Phaser.Types.Tweens.TimelineBuilderConfig} config - The configuration object for the Timeline.
*
* @return {Phaser.Tweens.Tween[]} An array of Tween instances that the Timeline will manage.
*/
var GetTweens = function (config)
{
var tweens = GetValue(config, 'tweens', null);
if (tweens === null)
{
return [];
}
else if (typeof tweens === 'function')
{
tweens = tweens.call();
}
if (!Array.isArray(tweens))
{
tweens = [ tweens ];
}
return tweens;
};
module.exports = GetTweens;