-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Feature/GIF #43 #44
base: master
Are you sure you want to change the base?
Feature/GIF #43 #44
Conversation
87312da
to
623aa78
Compare
Sorry I haven't reviewed this yet. I've been pretty overwhelmed with life stuff recently. I appreciate your work here though, and I hope to get to this soon. |
@suchipi |
623aa78
to
b6c284c
Compare
This is a first version of GIF component. The trouble with compressed gifs was fixed by a little trick (see this issue for more information). |
Thanks! :D I'll try to review this soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for doing this! I know it took a lot of research and talking to people to get gifken to handle transparent GIF frames. I'm sorry it took me so long to review it. Life has been stressful lately.
I left some comments; there are a couple things we'll need to change before this can be merged. The main thing is that we should use the Animation component instead of setInterval.
If you'd like, I can finish this work on your behalf. Or, I can leave it to you. Whichever you prefer.
height: options.height, | ||
}) | ||
|
||
setInterval(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setInterval
will keep playing forwards even if the game is paused from the developer inspector or the component is disabled. Could you instead use the Animation Component, which will only run when the game's frames advance?
* url: someGifFile, | ||
* width: 200, | ||
* height: 200, | ||
* fps: 20, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible for GIFs to have frames with different lengths; one frame can be long and the other can be short. Does gifken support this?
If you change the code to use the Animation component, you can specify the duration of each frame, and it will handle advancing to the next frame at the right time for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have find in the gifken documentation a property called delayCentiSeconds
I don't know if is exaclty what we want but i can test to set this property as duration when i will update the GIF component with the Animation component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, sounds good! You can use https://ezgif.com/maker to make a GIF that has frames with differing durations.
e5962bd
to
11caadf
Compare
@suchipi |
The Aseprite component uses Animation: https://github.com/suchipi/hex-engine/blob/43cd447c99611d7eb9e9a0305b60edf5b660de45/packages/2d/src/Components/Aseprite.ts In your code you'll want to:
|
GIF Component
See #43
I have create the GIF component using gifken
But there are a trouble with compressed gif see this issue
GIF component state :
Example