Samples preloading - a visual indication
-
Would it be possible to add some sort of a visual indication that the samples are preloading? Like a little blinking two-state button that disappears after they are loaded?
-
-
@d-healey Awesome, thank you!
-
If some of you would like to do a similar thing, here's a code I've ended up with:
// ****** IMAGE PRELOADER ****** // const var preloadBar = Content.getComponent("preloadBar"); preloadBar.loadImage("{PROJECT_FOLDER}loader.png", "filmstrip"); preloadBar.setImage("filmstrip", 0, 0); preloadBar.setTimerCallback(function() { this.data.progress = Engine.getPreloadProgress(); this.setImage("filmstrip", 0, parseInt(this.data.progress * 8) * 14); // number of frames * frame height }); preloadBar.setLoadingCallback(function(isPreloading) { this.data.progress = 0.0; this.set("visible", isPreloading); if(isPreloading) this.startTimer(50); else this.stopTimer(); });
-
The strange thing is that sometimes the animation happens and sometimes only the first frame is displayed. It disappears when the loading is finished so I guess it kind of serves the purpose. I can live with that, but maybe there's something wrong with the code after all?
-
@tomekslesicki said in Samples preloading - a visual indication:
The strange thing is that sometimes the animation happens and sometimes only the first frame is displayed
Could it be that sometimes it's loading really quickly so you're only seeing a quick flash of animation before the panel vanishes?
-
@d-healey I don't think so, when it doesn't animate, there's just no motion at all.