ghostrifle Posted March 26, 2014 Share Posted March 26, 2014 Hey guys, is there a way to not drain the battery of the mobile devices? I have a puzzle game which does not need 60 fps, just in some cases. e.g movement of a block. Is it possible to increase and decrease the amount of frames per second via the requestFrame-method ?? If you play my game on a mobile device, the battery will be empty in about 4 hours or so. Although, nothing happens on the screen but rendering. Quote Link to comment Share on other sites More sharing options...
rich Posted March 26, 2014 Share Posted March 26, 2014 Maybe don't use requestAnimationFrame at all? It's impossible to control the speed at which it runs, by default and design it's meant to run as fast as it can - but it sounds like you'd be better off using setTimeOut maybe? Quote Link to comment Share on other sites More sharing options...
ghostrifle Posted March 26, 2014 Author Share Posted March 26, 2014 Hmm... you might have bring up an idea to me just now (I think this was horrible english now Quote Link to comment Share on other sites More sharing options...
ghostrifle Posted March 27, 2014 Author Share Posted March 27, 2014 Yeah it worked. I refactored my code to be event-based so that only the 60fps are needed when some animations occured. I could save about 25% of battery life regarding to the non-event approach. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.