Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIF does not animate in runtime, only first frame shown (C2 GIFs animated in runtime) #1077

Closed
MikalDev opened this issue Dec 6, 2017 · 9 comments
Labels

Comments

@MikalDev
Copy link

MikalDev commented Dec 6, 2017

Problem description

GIFs on sprite do no animate during runtime.

Attach a .c3p

GIFFail.zip

A minimal Construct 3 project (.c3p) is required to be attached. Please see the guidelines

Steps to reproduce

  1. Load *.c3p, run

Observed result

GIF does not animate.

Expected result

GIF animated as it does in C2

Affected browsers

  • Chrome: yes
  • Firefox: NA
  • Edge: NA
  • Safari: NA

System details

Windows 10, Chrome

@NetOneGames
Copy link

Did you import animation from (gif) file? I ask as there is no animation in your example. you cant just add a gif as sprite you need to import it

@MikalDev
Copy link
Author

MikalDev commented Dec 6, 2017

I imported GIF into sprite animation (import file from animation mode)

@NetOneGames
Copy link

NetOneGames commented Dec 6, 2017

OK, strange, there are no animation frames in your example so there is nothing for construct to animate. Which indicates that the import didn't work. Not that the animation isn't playing.

@shortercode
Copy link

I'm not in the office today, but thought I'd chime in. I believe this has come up before, and the outcome was that there's no method for extracting animations from GIF files in the web browser. So short of writing a GIF decoder ( a lot of complex code with weird edge cases ) there wasn't much that could be done.

So tl;dr GIF files are treated as a static image.

@NetOneGames
Copy link

NetOneGames commented Dec 6, 2017

Oh yea youre right I tried it on my phone.
Import animation as gif doesn't work,
it either gives you a single image or a blank file.

That's a bit pants,
I used that feature a lot in C2. :(

@shortercode
Copy link

I can't find any related issue to it, so maybe it never made it as far as github or I could just be making it up.

I'll mark it as a C2 parity bug and will discuss it with the others when I'm back in the office. @AshleyScirra might chime in when he has a chance, he might remember better.

@AshleyScirra
Copy link
Member

The project only has one frame in the sprite which is why it doesn't animate. Unfortunately C3 can only import the first frame of a .gif, because browsers don't provide the necessary APIs to split apart their frames. It should be straightforward to find a tool to extract a gif to a sequence or strip of PNG images, which can be imported to C3.

GIF is an ancient format now and is already falling out of use - often on the web today when you see an animated image labelled "gif", it's really an MPEG-4 or WebM video, because GIF has poor compression ratios. APNG is a more modern equivalent, but we're still missing the browser APIs to read them. File a feature request here if you really want support for importing animated image formats: https://construct3.ideas.aha.io/
If it proves to be a popular feature we could look in to setting up custom image decoders, but this would be a lot of work for what I think is a fairly niche feature, and it should be straightforward to use PNG image sequences instead.

@MikalDev
Copy link
Author

MikalDev commented Dec 7, 2017

Ok, will file enhancement request. Likely not GIF, but animated texture / sprite (e.g. WebM), native playback (not decompose to sprites, which blows up memory.)

@castpixel
Copy link

make gif import happen, this is terrible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants