Comments (3)
This definitely makes sense - have you looked into whether there's any extra cost for doing this like there was for reactivity in #17 ? I'm happy to do so in the next couple days if not!
from trois.
Well, while doing the typescript refactoring I was thinking may be it's better to add :
addListener(type: 'init' | 'mounted' | 'beforerender' | 'afterrender' | 'resize', callback)
removeListener(type: 'init' | 'mounted' | 'beforerender' | 'afterrender' | 'resize', callback)
https://github.com/troisjs/trois/blob/d10c7d6a0242111537b249ad6bb921c9dcd64583/src/core/Renderer.ts
from trois.
Renderer event api with 0.3.0-beta.0 :
-
onInit(cb: InitCallbackType): void
-
onMounted(cb: MountedCallbackType): void
-
onBeforeRender(cb: RenderCallbackType): void
-
offBeforeRender(cb: RenderCallbackType): void
-
onAfterRender(cb: RenderCallbackType): void
-
offAfterRender(cb: RenderCallbackType): void
-
onResize(cb: ResizeCallbackType): void
-
offResize(cb: ResizeCallbackType): void
-
addListener(t: T, cb: EventCallbackMap[T]): void
-
removeListener(t: T, cb: EventCallbackMap[T]): void
Example :
this.$refs.renderer.onBeforeRender(() => {})
And we can use a prop to get renderer when it's ready :
- onReady: Function as PropType<(r: RendererInterface) => void>
But I don't know if we need more events props.
@SaFrMo feel free to comment if you have time
from trois.
Related Issues (20)
- Project status ? HOT 2
- typo: radiusSegments should be radialSegments
- how can i use lil-gui with trois.js?
- Renderer's resize funtion seems not to work when inside a flex-item? HOT 1
- How can we access and use delta of the renderer component? HOT 1
- Metalness => model.traverse is not a function HOT 2
- Is There a way to add an HDRI image as sky for better light? HOT 1
- why canvas is blank even tho the renderer works as expected?
- Performance with large number of geometries
- JSON loader?
- THREEJS. 0.149.0 brake TROISJS HOT 3
- Is PointMaterial fully supported? HOT 2
- DRACOLOADER.js how to extend the troidjs Loader HOT 1
- stopPropagation in events
- How to draw lines in troisjs, and how to use it with three.js? Thanks!
- umd version
- how to drag any model without TransformControls
- How to use trois with CSS3DRenderer? HOT 1
- Your test.glb file works perfectly. However, I only get a black screen with my own glb files HOT 1
- Can support for SpriteMaterial be added?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trois.