threepipe
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

script.ts 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. import {_testFinish, GLTFAnimationPlugin, ICamera, ThreeViewer} from 'threepipe'
  2. async function init() {
  3. const viewer = new ThreeViewer({
  4. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  5. msaa: true,
  6. })
  7. const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin)
  8. gltfAnimation.autoplayOnLoad = false
  9. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  10. await viewer.load('https://cdn.jsdelivr.net/gh/KhronosGroup/glTF-Blender-Exporter@master/polly/project_polly.gltf', {
  11. autoCenter: true,
  12. autoScale: true,
  13. })
  14. const fileCamera = viewer.scene.getObjectByName<ICamera>('Correction__MovingCamera')
  15. if (!fileCamera) return
  16. fileCamera.autoAspect = true
  17. fileCamera.userData.autoLookAtTarget = false
  18. fileCamera.activateMain()
  19. gltfAnimation.loopAnimations = false
  20. gltfAnimation.animateOnPageScroll = true
  21. gltfAnimation.pageScrollAnimationDamping = 0.1
  22. gltfAnimation.playAnimation()
  23. }
  24. init().finally(_testFinish)