threepipe
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

script.ts 1.2KB

123456789101112131415161718192021222324252627282930
  1. import {_testFinish, InteractionPromptPlugin, IObject3D, ThreeViewer} from 'threepipe'
  2. import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
  3. async function init() {
  4. const viewer = new ThreeViewer({
  5. canvas: document.getElementById('mcanvas') as HTMLCanvasElement,
  6. })
  7. const interactionPrompt = viewer.addPluginSync(new InteractionPromptPlugin())
  8. // distance in pixels
  9. interactionPrompt.animationDistance = 120
  10. // duration of one loop in ms
  11. interactionPrompt.animationDuration = 2000
  12. // set pause duration in between animations
  13. interactionPrompt.animationPauseDuration = 1000
  14. // delay before starting the animation again
  15. interactionPrompt.autoStartDelay = 5000
  16. // rotation distance in radians
  17. interactionPrompt.rotationDistance = 1
  18. await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr')
  19. await viewer.load<IObject3D>('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf')
  20. const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true))
  21. ui.setupPluginUi(InteractionPromptPlugin, {expanded: true})
  22. }
  23. init().finally(_testFinish)