| 1234567891011121314151617181920212223242526 |
- import { resolveVariant } from '../../render/utils/resolve-dynamic-variants.mjs';
- import { animateTarget } from './visual-element-target.mjs';
- import { animateVariant } from './visual-element-variant.mjs';
- function animateVisualElement(visualElement, definition, options = {}) {
- visualElement.notify("AnimationStart", definition);
- let animation;
- if (Array.isArray(definition)) {
- const animations = definition.map((variant) => animateVariant(visualElement, variant, options));
- animation = Promise.all(animations);
- }
- else if (typeof definition === "string") {
- animation = animateVariant(visualElement, definition, options);
- }
- else {
- const resolvedDefinition = typeof definition === "function"
- ? resolveVariant(visualElement, definition, options.custom)
- : definition;
- animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
- }
- return animation.then(() => {
- visualElement.notify("AnimationComplete", definition);
- });
- }
- export { animateVisualElement };
|