You can now specify additional ease function values via the easeParams property.

This commit is contained in:
photonstorm 2017-05-24 04:38:17 +01:00
parent 11f15fb424
commit bd4161e43b
4 changed files with 24 additions and 6 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '7eb44670-4029-11e7-aed7-5bc93456becc'
build: '54a28910-4032-11e7-bbd7-b5cbb879efb2'
};
module.exports = CHECKSUM;

View file

@ -1,11 +1,27 @@
var EaseMap = require('../math/easing/EaseMap');
var GetEaseFunction = function (ease)
var GetEaseFunction = function (ease, easeParams)
{
if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease))
{
// String based look-up
return EaseMap[ease];
if (easeParams)
{
var cloneParams = easeParams.slice(0);
cloneParams.unshift(0);
return function (v)
{
cloneParams[0] = v;
return EaseMap[ease].apply(this, cloneParams);
};
}
else
{
// String based look-up
return EaseMap[ease];
}
}
else if (typeof ease === 'function')
{

View file

@ -5,6 +5,7 @@ module.exports = [
'delay',
'duration',
'ease',
'easeParams',
'loop',
'loopDelay',
'offset',

View file

@ -202,7 +202,8 @@ var TweenBuilder = function (manager, config)
var props = GetProps(config);
// Default Tween values
var ease = GetEaseFunction(GetValue(config, 'ease', 'Power0'));
var easeParams = GetValue(config, 'easeParams', null);
var ease = GetEaseFunction(GetValue(config, 'ease', 'Power0'), easeParams);
var duration = GetNewValue(config, 'duration', 1000);
var yoyo = GetBoolean(config, 'yoyo', false);
var yoyoDelay = GetNewValue(config, 'yoyoDelay', 0);
@ -226,7 +227,7 @@ var TweenBuilder = function (manager, config)
targets[t],
key,
GetValueOp(key, value),
GetEaseFunction(GetValue(value, 'ease', ease)),
GetEaseFunction(GetValue(value, 'ease', ease), easeParams),
GetNewValue(value, 'delay', delay),
GetNewValue(value, 'duration', duration),
GetBoolean(value, 'yoyo', yoyo),