nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

CSS Animation not animating while page content loads

Open moranm6 opened this issue 11 years ago • 9 comments

I am trying to display an animated loading image while my page content loads. Here is a jsfiddle (expand the preview window and hit run) demonstrating this working properly (works when I test in chrome as well). When you hit "Run" the image is displayed and animated while content loads. However, in nw.js, the svg image is displayed while loading but does not animate.

When I remove the hiding on content load effect, the image animates after content is loaded in nw.js. However it will not animate while the content is loading, like it does in chrome.

I raised this as an issue because of the clear difference in behavior than chrome and my inability to find any means of correcting this. Is this expected behavior?

Thank you very much for your time, let me know if you have any questions or if I am being unclear.

EDIT: updated to correct JSfiddle

moranm6 avatar Jul 21 '15 17:07 moranm6

Since this is a multi-platform runtime, you should also include your testing environment's specs. For example, I am unable to reproduce your bug on a win32 build of v0.12.2 (click for native size):

nw.js-demo

rdtsc avatar Jul 21 '15 18:07 rdtsc

@rdtsc apparently I don't know how to properly share a jsfiddle (I just copied the URL) and it did not bring in the proper fiddle. I have just updated to the proper animation.

I just tried with the old animation (the one you show in your comment) and it works for me in v0.12.2 as well. However I still have the same issue with the animation in my updated jsfiddle. Any ideas as to why this might be? Thanks for looking into this.

moranm6 avatar Jul 21 '15 18:07 moranm6

Also, after a bit of research on similar CSS animation issues I tried adding "chromium-args": "--enable-experimental-web-platform-features --enable-threaded-compositing" but it did not fix my issue

moranm6 avatar Jul 21 '15 18:07 moranm6

In that case, your problem simply boils down to the fact that you're missing the -webkit- vendor prefix in your CSS @keyframes blocks. They are required in the version of Chromium v0.12.2 is built on. Newer builds (e.g., v0.13.0-a2) do not have this requirement.

Edit: Here's the patched CSS (:%s/@keyframes/@-webkit-keyframes/g) that works on v0.12.2: https://jsfiddle.net/wdydubuh/1/

For future reference, you should provide a minimal test case that reproduces the bug you're trying to report. In your case, that would have been a single object that was failing to be keyframed.

rdtsc avatar Jul 21 '15 18:07 rdtsc

@rdtsc thank you so much that makes perfect sense I completely overlooked that. However I'm still confused. I tried adding in the -webkit- prefix to the @keyframes blocks but I still get the same error. I even copied and pasted the CSS you fixed and still don't have any animation while the content is loading. Did you get a chance to test this in nwjs? Should I assume that I have a mistake elsewhere in my code or manifest?

Manifest currently looks like:

{ "webkit": {"plugin": true }, "name": "Name", "main": "index.html", "chromium-args": "--enable-experimental-web-platform-features --enable-threaded-compositing", "window": { "frame": true, "toolbar": true, "title": "App Title", "icon": "icon.png" } }

Thank you so much for the help.

moranm6 avatar Jul 21 '15 19:07 moranm6

Also, as I stated in my initial post, the image was animating after the page loaded if I didn't cloak it, and this was without the -webkit- prefix on @keyframes. This now seems strange to me since I am on v0.12.0.

moranm6 avatar Jul 21 '15 19:07 moranm6

@moranm6: Yes, I tested https://jsfiddle.net/wdydubuh/1/ against v0.12.2 with the following results (click for native size):

nwjs-demo

The only modification to your manifest was changing the main key to point to the fiddle linked above. The fiddle itself is an untouched clone of your original with the exception of the vendor prefix patch described in my previous reply. In any case, it seems like the inclusion of the experimental feature flag in your manifest should bypass the need for the vendor prefix.

rdtsc avatar Jul 21 '15 20:07 rdtsc

It doesn't sound like @moranm6 issue is with the animation itself, more likey with what the OP is doing related to the loading of their content and how they are starting the animation.

A settimeout could have a much different implementation than however the content is being loaded.

A link to the repo the code exists in, or even just copy pasting the code here could give far better insight into the issue @moranm6 is having.

RIAEvangelist avatar Jul 22 '15 03:07 RIAEvangelist

@RIAEvangelist that makes sense I guess I will close this for now since it might just be me, and I will try to get you some code to look at if you have time. Thanks

moranm6 avatar Jul 22 '15 15:07 moranm6