MCPcopy
hub / github.com/sveltejs/svelte / apply

Function apply

packages/svelte/src/internal/client/dom/elements/transitions.js:105–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103 from = this.element.getBoundingClientRect();
104 },
105 apply() {
106 animation?.abort();
107
108 to = this.element.getBoundingClientRect();
109
110 if (
111 from.left !== to.left ||
112 from.right !== to.right ||
113 from.top !== to.top ||
114 from.bottom !== to.bottom
115 ) {
116 const options = get_fn()(this.element, { from, to }, get_params?.());
117
118 animation = animate(
119 this.element,
120 options,
121 undefined,
122 1,
123 () => {},
124 () => {
125 animation?.abort();
126 animation = undefined;
127 }
128 );
129 }
130 },
131 fix() {
132 // If an animation is already running, transforming the element is likely to fail,
133 // because the styles applied by the animation take precedence. In the case of crossfade,

Callers

nothing calls this directly

Calls 2

animateFunction · 0.85
abortMethod · 0.80

Tested by

no test coverage detected