Timely from Photics

I decided to try using the code posted here Free Template Tuesday #38 – Tumult Hype “Timely” – Photics.com , but there was a small problem with the correct display of the next time scene. A fragment of the previous time interval is still displayed in front of it. How can I fix this? Where could the error be? The code posted here on the forum is good and working.

brazile.zip (1.1 MB)

It looks like you added the “time” function to every scene. It only needs to be the first scene.

Also, you might want to remove the randomized windows from the JavaScript. :blush:

One other thing — I'm thinking maybe "On Prepare for Display" might be better than "On Scene Load", but I'm not entirely sure.

1 Like

Big Thanks! What random windows can you remove in this code?

There is also a small question of how to remove the short-term illumination of the background of the previous scene in the current example, it is yellow for a given time interval.

You probably don't need this part…

 function windows(all) { // Randomize Windows
           
      var windows = document.getElementsByClassName("window");
      
      if (all) {    
          for (i = 0; i < windows.length; i++) {
          	r = Math.round(Math.random()) * 100;
          	windows[i].style.opacity = r + "%";
          }
      } else {
           r = Math.round(Math.random()) * 100;
           windows[Math.floor(Math.random() * windows.length)].style.opacity = r + "%";          
      }
 }

…and this…

      windows(true);

So, I looked into this problem and it's definitely not "On Prepare For Display". "On Scene Load" works better. Although, your project uses layouts. I'm not sure if that's a problem or not.

Screen Shot 2021-10-17 at 1.01.58 PM

If you're still having trouble, I did something goofy that got rid of the flash…

loading-scene

I created a “Loading” scene with no layouts. That scene then loads the correct scene. That should eliminate flashing, especially if you use transparent backgrounds.

I'm not entirely sure where the problem occurs — because I got lost. It's more difficult to test this project, as the code is sensitive to the time of day.

The real solution might be to not use scenes. Instead, use timelines. Then, when the scene is loaded, tell which timelines to run. That way, you could create nice animated effects.

3 Likes

Thanks! So I did it now, and it turned out as I intended.

1 Like