bill před 5 měsíci
rodič
revize
2dfbafa73d
1 změnil soubory, kde provedl 15 přidání a 12 odebrání
  1. 15 12
      src/views/animation/bottom.vue

+ 15 - 12
src/views/animation/bottom.vue

@@ -97,6 +97,7 @@ import TimeLineFrame from "@/components/drawing-time-line/frame.vue";
 import TimeLineAction from "@/components/drawing-time-line/action.vue";
 import empty from "@/components/drawing-time-line/empty.vue";
 import { Active } from "./type";
+import { animationGroup } from "@/sdk/association/animation";
 
 const props = defineProps<{
   am?: AnimationModel;
@@ -154,18 +155,20 @@ const count = computed(() =>
 const play = ref(false);
 
 watch(play, (_a, _b, onCleanup) => {
-  let isDes = false;
-  let prevNow = Date.now();
-  const animation = () => {
-    if (play.value && !isDes) {
-      const curNow = Date.now();
-      emit("update:currentTime", props.currentTime + (curNow - prevNow) * 0.001);
-      prevNow = curNow;
-      requestAnimationFrame(animation);
-    }
-  };
-  animation();
-  onCleanup(() => (isDes = true));
+  play ? animationGroup.play() : animationGroup.pause();
+
+  // let isDes = false;
+  // let prevNow = Date.now();
+  // const animation = () => {
+  //   if (play.value && !isDes) {
+  //     const curNow = Date.now();
+  //     emit("update:currentTime", props.currentTime + (curNow - prevNow) * 0.001);
+  //     prevNow = curNow;
+  //     requestAnimationFrame(animation);
+  //   }
+  // };
+  // animation();
+  // onCleanup(() => (isDes = true));
 });
 
 const renderer = ref<any>();