king2088 / vue-3d-loader

VueJS and threeJS 3d viewer plugin
https://king2088.github.io/vue-3d-loader-docs
MIT License
242 stars 40 forks source link

大佬vue2怎么自动旋转模型 #27

Closed yukangyang closed 1 year ago

yukangyang commented 1 year ago

No description provided.

king2088 commented 1 year ago
<template>
  <div>
    <vue3dLoader
      :height="200"
      :width="200"
      @load="onLoad"
      :filePath="['/model/Duck/Duck.gltf']"
      :rotation="rotation"
    ></vue3dLoader>
  </div>
</template>
<script>
export default {
  name: 'vuedtest',

  data() {
    return {
      rotation: {
        x: 0,
        y: 0,
        z: 0
      }
    }
  },
  methods: {
    onLoad() {
      this.rotate()
    },
    rotate() {
      requestAnimationFrame(rotate);
      rotation.z -= 0.01;
    }
  }
}
</script>
<style scoped>
</style>

代码有误,请查看关于vue2 的 demo代码:https://github.com/king2088/vue-3d-loader/blob/1.2.x/src/examples/rotate-model.vue

king2088 commented 1 year ago

请查看关于vue2 的 demo代码:https://github.com/king2088/vue-3d-loader/blob/1.2.x/src/examples/rotate-model.vue

king2088 commented 1 year ago

感谢感谢😁😁😁😘😘😘

成功了,记得给个start,谢谢