diff --git a/src/scene/ScenePlugin.js b/src/scene/ScenePlugin.js index 045d31e3a..048046994 100644 --- a/src/scene/ScenePlugin.js +++ b/src/scene/ScenePlugin.js @@ -334,6 +334,15 @@ var ScenePlugin = new Class({ this.manager.start(key, GetFastValue(config, 'data')); } + var onStartCallback = GetFastValue(config, 'onStart', null); + + var onStartScope = GetFastValue(config, 'onStartScope', this.scene); + + if (onStartCallback) + { + onStartCallback.call(onStartScope, this.scene, target, duration); + } + this.systems.events.emit(Events.TRANSITION_OUT, target, duration); this.systems.events.on(Events.UPDATE, this.step, this); diff --git a/src/scene/typedefs/SceneTransitionConfig.js b/src/scene/typedefs/SceneTransitionConfig.js index 0d9ca816a..5e4d8cfc5 100644 --- a/src/scene/typedefs/SceneTransitionConfig.js +++ b/src/scene/typedefs/SceneTransitionConfig.js @@ -11,5 +11,7 @@ * @property {boolean} [moveBelow] - Move the target Scene to be below this one before the transition starts. * @property {function} [onUpdate] - This callback is invoked every frame for the duration of the transition. * @property {any} [onUpdateScope] - The context in which the callback is invoked. + * @property {function} [onStart] - This callback is invoked when transition starting. + * @property {any} [onStartScope] - The context in which the callback is invoked. * @property {any} [data] - An object containing any data you wish to be passed to the target scene's init / create methods (if sleep is false) or to the target scene's wake event callback (if sleep is true). */