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

Method cancel

packages/core/ui/animation/index.ios.ts:212–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

210 }
211
212 public cancel(): void {
213 if (!this.isPlaying) {
214 Trace.write('Animation is not currently playing.', Trace.categories.Animation, Trace.messageType.warn);
215 return;
216 }
217
218 if (this._mergedPropertyAnimations) {
219 for (let i = 0; i < this._mergedPropertyAnimations.length; i++) {
220 const propertyAnimation = this._mergedPropertyAnimations[i];
221 if (propertyAnimation) {
222 if (propertyAnimation.target?.nativeViewProtected) {
223 const nativeView: NativeScriptUIView = propertyAnimation.target.nativeViewProtected;
224 if (nativeView.layer.mask) {
225 nativeView.layer.mask.removeAllAnimations();
226 }
227 nativeView.layer.removeAllAnimations();
228
229 // Gradient background animations
230 if (nativeView.gradientLayer) {
231 nativeView.gradientLayer.removeAllAnimations();
232 }
233
234 // Border animations
235 if (nativeView.borderLayer) {
236 if (nativeView.borderLayer.mask) {
237 nativeView.borderLayer.mask.removeAllAnimations();
238 }
239
240 const borderLayers = nativeView.borderLayer.sublayers;
241 if (borderLayers?.count) {
242 for (let i = 0, count = borderLayers.count; i < count; i++) {
243 borderLayers[i].removeAllAnimations();
244 }
245 }
246
247 nativeView.borderLayer.removeAllAnimations();
248 }
249
250 // Shadow animations
251 if (nativeView.outerShadowContainerLayer) {
252 if (nativeView.outerShadowContainerLayer.mask) {
253 nativeView.outerShadowContainerLayer.mask.removeAllAnimations();
254 }
255
256 const outerShadowLayers = nativeView.outerShadowContainerLayer.sublayers;
257 if (outerShadowLayers?.count) {
258 for (let i = 0, count = outerShadowLayers.count; i < count; i++) {
259 const shadowLayer = outerShadowLayers[i];
260
261 if (shadowLayer.mask) {
262 shadowLayer.mask.removeAllAnimations();
263 }
264 shadowLayer.removeAllAnimations();
265 }
266 }
267
268 nativeView.outerShadowContainerLayer.removeAllAnimations();
269 }

Callers

nothing calls this directly

Calls 2

removeAllAnimationsMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected