MCPcopy
hub / github.com/ionic-team/ionic-framework / createAnimation

Function createAnimation

core/src/utils/animation/animation.ts:33–995  ·  view source on GitHub ↗
(animationId?: string)

Source from the content-addressed store, hash-verified

31type AnimationReadWriteCallback = () => void;
32
33export const createAnimation = (animationId?: string): Animation => {
34 let _delay: number | undefined;
35 let _duration: number | undefined;
36 let _easing: string | undefined;
37 let _iterations: number | undefined;
38 let _fill: AnimationFill | undefined;
39 let _direction: AnimationDirection | undefined;
40 let _keyframes: AnimationKeyFrames = [];
41 let beforeAddClasses: string[] = [];
42 let beforeRemoveClasses: string[] = [];
43 let initialized = false;
44 let parentAnimation: Animation | undefined;
45 let beforeStylesValue: { [property: string]: any } = {};
46 let afterAddClasses: string[] = [];
47 let afterRemoveClasses: string[] = [];
48 let afterStylesValue: { [property: string]: any } = {};
49 let numAnimationsRunning = 0;
50 let shouldForceLinearEasing = false;
51 let shouldForceSyncPlayback = false;
52 let cssAnimationsTimerFallback: ReturnType<typeof setTimeout> | undefined;
53 let forceDirectionValue: AnimationDirection | undefined;
54 let forceDurationValue: number | undefined;
55 let forceDelayValue: number | undefined;
56 let willComplete = true;
57 let finished = false;
58 let shouldCalculateNumAnimations = true;
59 let ani: Animation;
60 let paused = false;
61
62 const id: string | undefined = animationId;
63 const onFinishCallbacks: AnimationOnFinishCallback[] = [];
64 const onFinishOneTimeCallbacks: AnimationOnFinishCallback[] = [];
65 const onStopOneTimeCallbacks: AnimationOnStopCallback[] = [];
66 const elements: HTMLElement[] = [];
67 const childAnimations: Animation[] = [];
68 const stylesheets: HTMLElement[] = [];
69 const _beforeAddReadFunctions: AnimationReadWriteCallback[] = [];
70 const _beforeAddWriteFunctions: AnimationReadWriteCallback[] = [];
71 const _afterAddReadFunctions: AnimationReadWriteCallback[] = [];
72 const _afterAddWriteFunctions: AnimationReadWriteCallback[] = [];
73 const webAnimations: globalThis.Animation[] = [];
74 const supportsAnimationEffect =
75 typeof (AnimationEffect as any) === 'function' ||
76 (win !== undefined && typeof (win as any).AnimationEffect === 'function');
77 /**
78 * This is a feature detection for Web Animations.
79 *
80 * Certain environments such as emulated browser environments for testing,
81 * do not support Web Animations. As a result, we need to check for support
82 * and provide a fallback to test certain functionality related to Web Animations.
83 */
84 const supportsWebAnimations =
85 typeof (Element as any) === 'function' &&
86 typeof (Element as any).prototype!.animate === 'function' &&
87 supportsAnimationEffect;
88
89 const getWebAnimations = () => {
90 return webAnimations;

Callers 15

createMethod · 0.90
mdEnterAnimationFunction · 0.90
mdLeaveAnimationFunction · 0.90
iosLeaveAnimationFunction · 0.90
iosEnterAnimationFunction · 0.90
mdEnterAnimationFunction · 0.90
mdLeaveAnimationFunction · 0.90
iosLeaveAnimationFunction · 0.90
iosEnterAnimationFunction · 0.90
mdEnterAnimationFunction · 0.90
mdLeaveAnimationFunction · 0.90
iosLeaveAnimationFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected