threepipe
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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