Kaynağa Gözat

chore(playground): use new composable on animations

alvarosabu 1 yıl önce
ebeveyn
işleme
6be07a5c1f
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  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
 })