Replies: 1 comment 1 reply
-
You can use <mesh
onAfterRender={state => console.log(state)}
/> Alternatively, as seen in the comments, import { addAfterEffect } from 'react-three-fiber'
addAfterEffect(() => console.log('Rendered')) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a bunch of E2E tests that take screenshots of my canvas, and I'm looking for a way to know precisely when to take the screenshots. I can log something to the console and look for this log in my E2E tests, but I need to log at the correct time -- that is, when the scene has "finished rendering", or when a specific object has rendered.
My attempt with
useFrame
was unsuccessful: I have a<mesh />
with aname
and I wait for this mesh to appear in thechildren
of the scene (state.scene.children
) before logging to the console. Unfortunately, this doesn't seem to do the trick: my screenshot remains blank. Is this the way to go and I just need to look for some other property of the state? Or isuseFrame
just not the right solution?addAfterEffect
seems promising, but I have to clue how to use it to detect the rendering of a specific object.Beta Was this translation helpful? Give feedback.
All reactions