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

fix GIF parsing for certain gif formats #3172

Closed
eonarheim opened this issue Aug 9, 2024 Discussed in #3170 · 0 comments · Fixed by #3173
Closed

fix GIF parsing for certain gif formats #3172

eonarheim opened this issue Aug 9, 2024 Discussed in #3170 · 0 comments · Fixed by #3173

Comments

@eonarheim
Copy link
Member

Discussed in #3170

Originally posted by ambmcmdmem626 August 7, 2024
Version: 0.29.3

Premise

I want to implement a loading screen with the following GIF (20ms x 85 frames) and Gif.toAnimation():

snake_loading

Main Topic

When I checked the operation of the animation in the Excalibur sandbox, it displayed as follows
(A different animation was displayed from this GIF.):

Untitled.video.-.Made.with.Clipchamp.mp4

Additionally, I have confirmed that the image(animation) displays correctly when using sandbox/tests/gif/sword.gif.

Could this be due to a setting issue?
* I will continue my investigation and will update you as soon as I find out more!

Also, below are the code and network tabs for reference.

The code

* This is almost the same as sandbox/tests/gif/animatedGif.ts

/// <reference path="../../lib/excalibur.d.ts" />

var game = new ex.Engine({
  canvasElementId: 'game',
  width: 600,
  height: 400,
  displayMode: ex.DisplayMode.FitScreen,
  antialiasing: false
});

game.currentScene.camera.zoom = 2;

var gif: ex.Gif = new ex.Gif('./snake_loading.gif', ex.Color.Transparent); // changed path and color
var loader = new ex.Loader([gif]);
game.start(loader).then(() => {
  var actor = new ex.Actor({ x: game.currentScene.camera.x, y: game.currentScene.camera.y, width: gif.width, height: gif.height });
  actor.graphics.add(gif.toAnimation(20)); // 500 → 20
  game.add(actor);
});

Network

* The GIF(focused) was retrieved correctly, but I think the data:image was not retrieved as intended.

image

Gif.ts:570

img.src = c.toDataURL();

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

Successfully merging a pull request may close this issue.

1 participant