Detect gif animation completion

Hello all,

I am using a gif as a preloader and it all works fine.

However there’s a case when the scene is fully loaded but the gif animation is not yet complete, in this case
we need to add a button like “Skip Intro” while keeping the gif to play to end.

So I need to detect if the gif animation is complete or no.

What hints you can give? anyone tried this before with PC?

I tried this but had an issue with “require is not defined” then read that its a node.js thing … etc and I think this method doesn’t have a chance to work, although might have.

Any suggestions?

I assume that you are using a custom preloader?

You basically have two problems, one is to detect if a GIF has finished playing (not a PlayCanvas problem and if you know how long the GIF is in seconds, you can just use setTimeout())

The second problem is to ‘start’ the PlayCanvas on demand vs it telling the preloader to hide the splash screen. There is thread here that will help: Delay Loading Screen