Skip to content

Commit

Permalink
refactor(app): 329 Add rotation animations
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeTorrealba committed Jan 12, 2024
1 parent 471e28a commit cd9643c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions playground/src/components/ModelsDemo.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useRenderLoop } from '@tresjs/core'
import { useGLTF, GLTFModel, useFBX, FBXModel } from '@tresjs/cientos'
import { NoToneMapping } from 'three'
Expand All @@ -20,6 +21,17 @@ const gl = {
alpha: true,
toneMapping: NoToneMapping,
}
const { onLoop } = useRenderLoop()
onLoop(() => {
if (akuAkuRef.value) {
akuAkuRef.value.value.rotation.y += 0.01
}
if (jeepRef.value) {
jeepRef.value.value.rotation.y -= 0.01
}
})
</script>

<template>
Expand All @@ -33,7 +45,7 @@ const gl = {
ref="akuAkuRef"
:path="modelPath"
draco
:position="[0, -2, 0]"
:position="[0, -2, 2]"
:rotation-x="0.5"
name="Aku_aku"
cast-shadow
Expand All @@ -50,7 +62,7 @@ const gl = {
ref="jeepRef"
:path="modelPathFbx"
:scale="0.01"
:position="[-6, -1, 2]"
:position="[0, -1, -2]"
name="jeep_model"
cast-shadow
/>
Expand Down
1 change: 1 addition & 0 deletions playground/src/pages/loaders/UseGLTFDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const gl = {
<TresDirectionalLight
:intensity="1"
cast-shadow
:position="[0, 10, 0]"
/>
</TresCanvas>
</template>

0 comments on commit cd9643c

Please sign in to comment.