MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / play

Method play

packages/core/ui/animation/index.android.ts:160–190  ·  view source on GitHub ↗
(resetOnFinish?: boolean)

Source from the content-addressed store, hash-verified

158 }
159
160 public play(resetOnFinish?: boolean): AnimationPromise {
161 if (resetOnFinish !== undefined) {
162 this._resetOnFinish = resetOnFinish;
163 }
164
165 if (this.isPlaying) {
166 return this._rejectAlreadyPlaying();
167 }
168
169 const animationFinishedPromise = super.play();
170
171 if (!this._animatorSet) {
172 this._animators = new Array<android.animation.Animator>();
173 this._propertyUpdateCallbacks = new Array<Function>();
174 this._propertyResetCallbacks = new Array<Function>();
175
176 for (let i = 0, length = this._propertyAnimations.length; i < length; i++) {
177 this._createAnimators(this._propertyAnimations[i]);
178 }
179
180 this._nativeAnimatorsArray = Array.create(android.animation.Animator, this._animators.length);
181 for (let i = 0, length = this._animators.length; i < length; i++) {
182 this._nativeAnimatorsArray[i] = this._animators[i];
183 }
184
185 this._animatorSet = new android.animation.AnimatorSet();
186 this._animatorSet.addListener(this._animatorListener);
187 }
188 this._play();
189 return animationFinishedPromise;
190 }
191
192 public cancel(): void {
193 if (!this.isPlaying) {

Callers

nothing calls this directly

Calls 5

_createAnimatorsMethod · 0.95
_playMethod · 0.95
addListenerMethod · 0.80
playMethod · 0.65
createMethod · 0.65

Tested by

no test coverage detected