low fps with html5 canvas | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

low fps with html5 canvas

i dont know why but fps in my device cannot be more than 30fps (~15 at most of the time). this keep ruining experience with canvas based creation. i tried to make some html5 game before, i was devoping with ~15 fps with the gametick relied heavily on fps. when the game played in other device (~60fps) the gametick just going up 4x faster, thus making the game unplayable. this is happen with my flappybird game, its nolonger playable i already remove the assets. i feel like i'm done with html5 game making, but earlier today i play free online game its using html5, yet i still getting 60fps. what did i actually miss here ? why i cant run much simpler, lighter resources based game in higher fps ? i wrote this yesterday, still getting 15fps :/ https://code.sololearn.com/W1ohawNfXHAh/?ref=app

19th Oct 2019, 9:12 AM
Taste
Taste - avatar
2 Antworten
+ 1
Try to reduce 4 sets of new Date().now to a single set in animate function.
19th Oct 2019, 9:26 AM
Calviղ
Calviղ - avatar
+ 1
still not reaching 20fps, i ran this code in older phone and still get 58-60fps.
19th Oct 2019, 9:52 AM
Taste
Taste - avatar