You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been writing a game that uses Kinetic and there are soldiers that shoot at each other. In Chrome the bullets animate fine when the tab is active but if you go to another tab for a few seconds or more and then come back to the original tab, you can see that something isn't quite right with how it didn't animate away the bullet impacts. I'm using the transitionTo method for all of the bullet impacts and bullet movements so I think it has to do with the transitionTo function not calling the callback method correctly or something when the tab isn't active.
ah yes, I've seen this before but haven't gotten to it yet. There's definitely some weirdness that goes on when you change tabs. The problem isn't actually KineticJS, per say, but with the requestAnimationFrame implementation of the browser. I do certainly need to add something in that prevents this from happening, perhaps some logic that detects if a new tab was activated, and then halt the animation until focus is returned. Not sure if this is even possible though.
Actually, I think the solution is to bind to the draw/tick event for Kinetic for each frame instead instead of using setInterval() to manage my game state. I'll give that a shot.
I've been writing a game that uses Kinetic and there are soldiers that shoot at each other. In Chrome the bullets animate fine when the tab is active but if you go to another tab for a few seconds or more and then come back to the original tab, you can see that something isn't quite right with how it didn't animate away the bullet impacts. I'm using the transitionTo method for all of the bullet impacts and bullet movements so I think it has to do with the transitionTo function not calling the callback method correctly or something when the tab isn't active.
You can see an example of it here.
http://wargame.azurewebsites.net/
Here is the code in TypeScript that does the shooting of the bullets and then shows the bullet impact for 0.15 seconds.
The text was updated successfully, but these errors were encountered: