Browse Source

chore(playground): use new composable on animations

alvarosabu 1 year ago
parent
commit
6be07a5c1f
1 changed files with 5 additions and 2 deletions
  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
 })