Selaa lähdekoodia

chore(playground): use new composable on animations

alvarosabu 1 vuosi sitten
vanhempi
commit
6be07a5c1f
1 muutettua tiedostoa jossa 5 lisäystä ja 2 poistoa
  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
 })