Files
JiboOs/docs/rendering/tween/TweenManager.js
2026-03-16 13:53:01 +02:00

94 lines
3.4 KiB
JavaScript

/**
* Manage the tweens.
* Uses `ease npm` for all ease functions.
* For ease types, refer to [ease APIs]{@link https://www.npmjs.com/package/eases}.
* @class TweenManager
* @memberof jibo.face
*/
/**
* Collection of tweens.
* @private
* @name jibo.face.TweenManager._tweens
* @type {Array<jibo.face.Tween>}
*/
/**
* Collection of tweens to pool (recycle).
* @private
* @name jibo.face.TweenManager._tweens
* @type {Array<jibo.face.Tween>}
*/
/**
* Add a tween to play.
* @method jibo.face.TweenManager.play
* @param {Object} target The object to tween.
* @param {Object} options Options for tweening.
* @param {Object} options.to The values to tween the object to.
* @param {Object} [options.from] The initial values to set the object to.
* @param {String} [options.ease='linear'] The ease function to use.
* @param {int} [options.delay=0] The delay to start.
* @param {int} [options.duration=500] Length of tween, in millseconds.
* @param {Function} [complete] Function callback wehen completed
* @return {jibo.face.Tween} Instance of new tween.
*/
/**
* Play a set of tweens.
* @method jibo.face.TweenManager.playSet
* @param {Array<Object>} targets The list of items to tween.
* @param {Object} options Options for tweening.
* @param {Number} options.to The value to tween to.
* @param {Number} [options.from=0] The initial value to tween.
* @param {String} [options.ease='linear'] The ease function to use.
* @param {int} [options.delay=0] The delay to start.
* @param {int} [options.duration=500] Length of tween, in millseconds.
* @param {Object|Function} [setOptions] Either the set options for complete function
* @param {Number} [setOptions.focus=0] Index to lead with if `setOptions.delay` is set.
* @param {Boolean} [setOptions.focusIsLast=false] `true` if `setOptions.focus` is first in.
* @param {Number} [setOptions.delay=0] Milliseconds delay between items.
* @param {Function} [setOptions.complete] Function callback wehen completed
* @param {Boolean} [setOptions.completeOnFirst=false] If 'true' fires callback after first tween completes, if `false` fires after all tween complete
*/
/**
* Stop a tween by target or stop all tweens.
* @method jibo.face.TweenManager.stop
* @param {Object} [target] The tween target, if non is specified, all tweens removed.
* @return {Boolean} If the tween was deleted.
*/
/**
* Stop all tweens whose targets return true against provided method.
* @method jibo.face.TweenManager.stopCheck
* @param {Function} check - Function must take a tween target and return a boolean,
* passing an additional Object to test against is optional.
* @param {any} [against] - Object to test against in check method.
*/
/**
* Pause or resume all tweens.
* @name jibo.face.TweenManager.paused
* @type {Boolean}
*/
/**
* Update the tweens.
* @method jibo.face.TweenManager.update
* @param {int} elapsed Time elapsed in Milliseconds since the last update.
*/
/**
* Recycle the tween.
* @method jibo.face.TweenManager._pool
* @private
* @param {jibo.face.Tween} tween Tween to re-pool
*/
/**
* Recycle the tween.
* @method jibo.face.TweenManager._create
* @private
* @return {jibo.face.Tween} Tween to use
*/