threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InteractionPromptPlugin.md 1.8KB

пре 1 година
пре 1 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---
  2. prev:
  3. text: 'LoadingScreenPlugin'
  4. link: './LoadingScreenPlugin'
  5. next:
  6. text: 'TransformControlsPlugin'
  7. link: './TransformControlsPlugin'
  8. ---
  9. # InteractionPromptPlugin
  10. [//]: # (todo: image)
  11. [Example](https://threepipe.org/examples/#interaction-prompt-plugin/) —
  12. [Source Code](https://github.com/repalash/threepipe/blob/master/src/plugins/interaction/InteractionPromptPlugin.ts) —
  13. [API Reference](https://threepipe.org/docs/classes/InteractionPromptPlugin.html)
  14. Interaction Prompt Plugin adds a hand pointer icon over the canvas that moves to prompt the user to interact with the 3d scene. To use, simply add the plugin to the viewer.
  15. The default pointer icon from [google/model-viewer](https://github.com/google/model-viewer) and can be configured with the `pointerIcon` property.
  16. The pointer is automatically shown when some object is in the scene and the camera are not moving.
  17. The animation starts after a delay and stops on user interaction. It then restarts after a delay after the user stops interacting
  18. The plugin provides several options and functions to configure the automatic behaviour or trigger the animation manually.
  19. ```typescript
  20. import {ThreeViewer, InteractionPromptPlugin} from 'threepipe'
  21. const viewer = new ThreeViewer({...})
  22. const interactionPrompt = viewer.addPluginSync(new InteractionPromptPlugin())
  23. // change duration
  24. interactionPrompt.animationDuration = 3000
  25. // change animation distance in pixels
  26. interactionPrompt.animationDistance = 100
  27. // disable auto start when the camera stops
  28. interactionPrompt.autoStart = false
  29. interactionPrompt.autoStop = false
  30. // manually start and stop
  31. interactionPrompt.startAnimation()
  32. // ...
  33. interactionPrompt.stopAnimation()
  34. ```
  35. Note - The pointer is automatically shown/hidden when animation is started/stopped.