Blame view

天文台pc/tianwentai-ui/node_modules/motion-dom/dist/es/animation/interfaces/visual-element.mjs 1.11 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  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 };
  //# sourceMappingURL=visual-element.mjs.map