Help with Animated GIFs...
Help with Animated GIFs...
Hello Guys
Hope that you're having a nice 2023.
I'm working on an old project and need to put 2 animated gifs on screen, but since I'm on a Repeat LOOP scene and image is refreshed a few times per second, GIF doesn't animate at all. If I try to use a Delay(3000) to stop program for 3 seconds and allow user to see the animation, of course NOT working at all because all the program stops and GIF do not animate.
Any simple solution for this? Am I doing anything wrong? I'm using OpenScreen and never found a way to use this language without the Repeat LOOP, as I normaly do on other languages, keeping the screen static and changing only texts and images. Is that possible on PB 6.0?
Sorry, now I have 2 questions: one for animated gifs and another for no Repeat solution.
Can you help me?
Hope that you're having a nice 2023.
I'm working on an old project and need to put 2 animated gifs on screen, but since I'm on a Repeat LOOP scene and image is refreshed a few times per second, GIF doesn't animate at all. If I try to use a Delay(3000) to stop program for 3 seconds and allow user to see the animation, of course NOT working at all because all the program stops and GIF do not animate.
Any simple solution for this? Am I doing anything wrong? I'm using OpenScreen and never found a way to use this language without the Repeat LOOP, as I normaly do on other languages, keeping the screen static and changing only texts and images. Is that possible on PB 6.0?
Sorry, now I have 2 questions: one for animated gifs and another for no Repeat solution.
Can you help me?
Re: Help with Animated GIFs...
It depends on your used code.
How you display gifs on an OpenScreen?
So please provide a small working code which shows your problem.
In general you need also a window event loop and there you can execute the timer events.
How you display gifs on an OpenScreen?
So please provide a small working code which shows your problem.
In general you need also a window event loop and there you can execute the timer events.
Re: Help with Animated GIFs...
Hi, Thanks for your question:How you display gifs on an OpenScreen?
So please provide a small working code which shows your problem.
I don't have the code here, but it's easy to answer:
I LoadSprite as I do for any other image. Since I load the GIFDecoder, I DisplayTransparentSprite as I do for my other images, JPEG or GIFs, and everything runs fine, but... and here is the but... after Display Sprite done, the program continues and gets to Until ESC pressed, looping and repeating the main LOOP again and again. This is the problem.
Should I use an independent Thread Task to process the GIF? That will be a Pain in the... because I was expecting to use quite a few of this animated gifs.
Maybe the best solution is to create a DIM with the frames and load each one every time the program loops. Is not a wonderful solution and a bit heavier than desired, but it works fine. I was trying to simplify the code, expecting to see a new DisplayAnimatedSprite or something like that.
There isn't anything like this yet, right?
Re: Help with Animated GIFs...
The quick, dirty but simple way is to use AddWindowTimer and display a frame "on each new event".
Re: Help with Animated GIFs...
So you are using only OpenScreen() and Sprites.
Animated Gifs ar only implemented for Images and, as I know, not for Sprites,
There is no function called SetSpriteFrame(), only SetImageFrame()
See also help for UseGIFImageDecoder().
LoadSprite() and CatchSprite() does not support multi-frame GIFs.
Animated Gifs ar only implemented for Images and, as I know, not for Sprites,
There is no function called SetSpriteFrame(), only SetImageFrame()
See also help for UseGIFImageDecoder().
LoadSprite() and CatchSprite() does not support multi-frame GIFs.
Re: Help with Animated GIFs...
Last edited by JHPJHP on Sat Jan 21, 2023 4:43 pm, edited 1 time in total.
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: Help with Animated GIFs...
This was my hope about...infratec wrote: Sat Jan 21, 2023 3:38 pm So you are using only OpenScreen() and Sprites.
Animated Gifs ar only implemented for Images and, as I know, not for Sprites,
There is no function called SetSpriteFrame(), only SetImageFrame()
See also help for UseGIFImageDecoder().
LoadSprite() and CatchSprite() does not support multi-frame GIFs.
After so many years without touch this PB again, I thought that it could have been added...
Thanks for your Help!
Re: Help with Animated GIFs...
Thanks for your answer and help, but this is almost what I am doing in a simplyfied way.JHPJHP wrote: Sat Jan 21, 2023 3:59 pm Hi Kamarro,
See Windows Services & Other Stuff\Other_Stuff\AnimatedGIF\MovableSpriteObject.pb
The hard bone of this is the creation of each frame to display individually, that's what I expected to be able to avoid.
No problem at all. I already acepted the fact that I don't have a static display page and that I need a Repeat Display Loop... This is , in fact, the biggest low point of this language for me. I am used to easier display this, display that without the need of a LOOP.
Since I can't do that, I have to change the programs in accordance with the language.
Thanks a lot.
Re: Help with Animated GIFs...
What happened to my Replies???
I answered one post with a small quote and a little sample of my exact program and IT Disappeared.
I answered a second reply from another user with a larger example of my program and the post has been deleted? Why???
It was just a small and simple sample of what I am doing, no bad words, no antipathy to anyone, nothing.
What have I done to get my posts deleted?
Is there a reason, I dont't believe that was a bug...
Did you already experienced this situation?
I answered one post with a small quote and a little sample of my exact program and IT Disappeared.
I answered a second reply from another user with a larger example of my program and the post has been deleted? Why???
It was just a small and simple sample of what I am doing, no bad words, no antipathy to anyone, nothing.
What have I done to get my posts deleted?
Is there a reason, I dont't believe that was a bug...
Did you already experienced this situation?
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Help with Animated GIFs...
Thank you but no, it doesn't.
I can not use gadgets. I need to use only OpenScreen and Sprites. Program is big and almost finished. This is a fullscreen game, not an application with windows and things like that.
I already posted the solution that I am using but, for no known reason my two posts with program samples disappeared. Sorry!
Thanks the same!
Re: Help with Animated GIFs...
In between, i posted a reply with 3 solution for GIF multi-frame files. Then JHPJHP posted his solution - so i erased my post. So this thread was quite busy in between and maybe the forum software had a hickup due to that - just a guess.Kamarro wrote: Sat Jan 21, 2023 4:37 pm Is there a reason, I dont't believe that was a bug...
Did you already experienced this situation?
Re: Help with Animated GIFs...
LOL... Maybe there's a bug about deleting posts with direct replies. You shouldn't be able to delete your post if the post already has a public reply. This is a misconception error on phpBB settings. The administration should change this, because my answers could be helpful to someone who wants to put an animated gif inside a loop...Bitblazer wrote: Sat Jan 21, 2023 4:56 pmIn between, i posted a reply with 3 solution for GIF multi-frame files. Then JHPJHP posted his solution - so i erased my post. So i assume this threat was quite busy in between and maybe the forum software had a hickup - just a guess.Kamarro wrote: Sat Jan 21, 2023 4:37 pm Is there a reason, I dont't believe that was a bug...
Did you already experienced this situation?
Whatever, I've seen worse on this forums!

Re: Help with Animated GIFs...
Maybe this works.
Threads can not be used, since SpriteOutput() needs to be called in the same thread as OpenScreen().
I moved the code to Tips 'n' Tricks:
viewtopic.php?p=594218
Threads can not be used, since SpriteOutput() needs to be called in the same thread as OpenScreen().
I moved the code to Tips 'n' Tricks:
viewtopic.php?p=594218
Last edited by infratec on Sat Jan 21, 2023 11:25 pm, edited 9 times in total.