I compiled an edited code from this one
Edited Adding Animation
Interestingly, when i checked the binaries build for html5, flash and linux, the html5 build viewed from chrome has a smoother and fluid animation. The flash and linux build could animate smoothly but stutters at many moments specially when the window is moved.
Why is this so?
Could we learn something from this to smoothen and improve performance of build for other platforms?
Note: I have ensured that all binaries are running on the same fps.
Are you still using
Timer, or did you switch to
I used ENTER_FRAME in this one.
Hmm… I have a few thoughts here, but I don’t expect any of them to help.
- There used to be a bug with 60fps, and people reported that switching to 61fps fixed the lag spikes. I think this has been fixed, though.
- I wouldn’t worry too much about moving the window, as long as the lag goes away afterwards. It’s not like people will be moving the window very much.
- The Flash target isn’t actually under OpenFL’s control, but the Linux target is. So it seems that you have two separate bugs here: lag in the Flash build, and lag in the Linux build.
Question: can you reproduce this in one of OpenFL’s samples? Try one of the ones with animation, like ActuateExample.
requestAnimationFrame which is probably using vsync.
I believe that SDL2 stops drawing when dragging a window, this lag actually is the window not updating until you release
Do you handle delta time in your ENTER_FRAME listeners? If you don’t, animation (even with a high frame rate) can look choppy
It just bothers me much that native built got choppy animation than html5 that uses google chrome then uses native environment. There were several layers yet html5 wins victorious!
I tested the same codes in a windows pc with a mid range specs. To my surprise, i got almost the same result for flash and html5 build, html5 animates smoother and more fluid! It may be likely that this goes on to the flash platform.
I used the standard example from openfl: AddingAnimation. Then instead of the usual animation, i changed it to moving w/ bounce on the wall. I will try to increase the fps to 61 and enable vsync in xml.
By far, I dont know how to handle delta time in ENTER_FRAME. I tested Actuate Tween vs. my standard ENTER_FRAME codes, Actuate has more fluid and smoother animation, so I may consider it as well in testing flash, native and google-html5 build.
I got it! like what player_3 and singmajesty mentioned, it maybe related to vsync and flash, so when I set vsync=“true” the native linux build runs smooth and fluid, or may be smoother than html5. Moving the window does not seem to affect the animation.
On the other hand, the flash build got more smoother animation but still gets more frequent stuttering, so i guess, its now more in Flash player problem now.