package.esm2022.src.players.animation_player.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of animations Show documentation
Show all versions of animations Show documentation
Angular - animations integration with web-animations
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* An empty programmatic controller for reusable animations.
* Used internally when animations are disabled, to avoid
* checking for the null case when an animation player is expected.
*
* @see {@link animate}
* @see {@link AnimationPlayer}
*
* @publicApi
*/
export class NoopAnimationPlayer {
constructor(duration = 0, delay = 0) {
this._onDoneFns = [];
this._onStartFns = [];
this._onDestroyFns = [];
this._originalOnDoneFns = [];
this._originalOnStartFns = [];
this._started = false;
this._destroyed = false;
this._finished = false;
this._position = 0;
this.parentPlayer = null;
this.totalTime = duration + delay;
}
_onFinish() {
if (!this._finished) {
this._finished = true;
this._onDoneFns.forEach((fn) => fn());
this._onDoneFns = [];
}
}
onStart(fn) {
this._originalOnStartFns.push(fn);
this._onStartFns.push(fn);
}
onDone(fn) {
this._originalOnDoneFns.push(fn);
this._onDoneFns.push(fn);
}
onDestroy(fn) {
this._onDestroyFns.push(fn);
}
hasStarted() {
return this._started;
}
init() { }
play() {
if (!this.hasStarted()) {
this._onStart();
this.triggerMicrotask();
}
this._started = true;
}
/** @internal */
triggerMicrotask() {
queueMicrotask(() => this._onFinish());
}
_onStart() {
this._onStartFns.forEach((fn) => fn());
this._onStartFns = [];
}
pause() { }
restart() { }
finish() {
this._onFinish();
}
destroy() {
if (!this._destroyed) {
this._destroyed = true;
if (!this.hasStarted()) {
this._onStart();
}
this.finish();
this._onDestroyFns.forEach((fn) => fn());
this._onDestroyFns = [];
}
}
reset() {
this._started = false;
this._finished = false;
this._onStartFns = this._originalOnStartFns;
this._onDoneFns = this._originalOnDoneFns;
}
setPosition(position) {
this._position = this.totalTime ? position * this.totalTime : 1;
}
getPosition() {
return this.totalTime ? this._position / this.totalTime : 1;
}
/** @internal */
triggerCallback(phaseName) {
const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
methods.forEach((fn) => fn());
methods.length = 0;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5pbWF0aW9uX3BsYXllci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2FuaW1hdGlvbnMvc3JjL3BsYXllcnMvYW5pbWF0aW9uX3BsYXllci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUF1R0g7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxPQUFPLG1CQUFtQjtJQVk5QixZQUFZLFdBQW1CLENBQUMsRUFBRSxRQUFnQixDQUFDO1FBWDNDLGVBQVUsR0FBZSxFQUFFLENBQUM7UUFDNUIsZ0JBQVcsR0FBZSxFQUFFLENBQUM7UUFDN0Isa0JBQWEsR0FBZSxFQUFFLENBQUM7UUFDL0IsdUJBQWtCLEdBQWUsRUFBRSxDQUFDO1FBQ3BDLHdCQUFtQixHQUFlLEVBQUUsQ0FBQztRQUNyQyxhQUFRLEdBQUcsS0FBSyxDQUFDO1FBQ2pCLGVBQVUsR0FBRyxLQUFLLENBQUM7UUFDbkIsY0FBUyxHQUFHLEtBQUssQ0FBQztRQUNsQixjQUFTLEdBQUcsQ0FBQyxDQUFDO1FBQ2YsaUJBQVksR0FBMkIsSUFBSSxDQUFDO1FBR2pELElBQUksQ0FBQyxTQUFTLEdBQUcsUUFBUSxHQUFHLEtBQUssQ0FBQztJQUNwQyxDQUFDO0lBQ08sU0FBUztRQUNmLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLENBQUM7WUFDcEIsSUFBSSxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUM7WUFDdEIsSUFBSSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsQ0FBQyxFQUFF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