threepipe
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

FrameFadePlugin.md 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ---
  2. prev:
  3. text: 'GeometryUVPreviewPlugin'
  4. link: './GeometryUVPreviewPlugin'
  5. next:
  6. text: 'VignettePlugin'
  7. link: './VignettePlugin'
  8. ---
  9. # FrameFadePlugin
  10. [//]: # (todo: image)
  11. [Example](https://threepipe.org/examples/#frame-fade-plugin/) —
  12. [Source Code](https://github.com/repalash/threepipe/blob/master/src/plugins/pipeline/FrameFadePlugin.ts) —
  13. [API Reference](https://threepipe.org/docs/classes/FrameFadePlugin.html)
  14. FrameFadePlugin adds a post-render pass to the render manager and blends the last frame with the current frame over time. This is useful for creating smooth transitions between frames for example when changing the camera position, material, object properties, etc. to avoid a sudden jump.
  15. ```typescript
  16. import {ThreeViewer, FrameFadePlugin} from 'threepipe'
  17. const viewer = new ThreeViewer({...})
  18. const fadePlugin = viewer.addPluginSync(new FrameFadePlugin())
  19. // Make some changes in the scene (any visual change that needs to be faded)
  20. // Start transition and wait for it to finish
  21. await fadePlugin.startTransition(400) // duration in ms
  22. ```
  23. To stop a transition, call `fadePlugin.stopTransition()`. This will immediately set the current frame to the last frame and stop the transition. The transition is also automatically stopped when the camera is moved or some pointer event occurs on the canvas.
  24. The plugin automatically tracks `setDirty()` function calls in objects, materials and the scene. It can be triggerred by calling `setDirty` on any material or object in the scene. Check the [example](https://threepipe.org/examples/#frame-fade-plugin/) for a demo. This can be disabled by options in the plugin.