浏览代码

chore(playground): use new composable on animations

alvarosabu 1 年之前
父节点
当前提交
6be07a5c1f
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      playground/src/components/TheSphere.vue

+ 5 - 2
playground/src/components/TheSphere.vue

@@ -1,9 +1,12 @@
 <!-- eslint-disable no-console -->
 <script setup lang="ts">
-import { useUpdate } from '@tresjs/core'
+import { useLoop } from '@tresjs/core'
 
 const sphereRef = ref()
-useUpdate((state) => {
+
+const { onBeforeRender } = useLoop()
+
+onBeforeRender((state) => {
   if (!sphereRef.value) { return }
   sphereRef.value.position.y += Math.sin(state.elapsed) * 0.01
 })