Animated gif problem :/
Author |
Message |
m3mb3r
|
Posted: Tue May 29, 2012 6:33 pm Post subject: Animated gif problem :/ |
|
|
What is it you are trying to achieve?
Load an animated pic without flickering.
What is the problem you are having?
whenever i load an animated gif of 2 pics or w.e, lets say a head which opens mouth then closes, it will flicker rite. so i set the screen with offscreenonly with view.update but then it only does first frame then freezes?? here's code sample (put a animated gif of 2 frames in there and look):
I just started with this i could of easily made a mistake thanks for any help in advance!
Describe what you have tried to solve this problem
Messing around with the view.update.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using
4.1.1 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
turinggirl
|
Posted: Tue May 29, 2012 8:50 pm Post subject: Re: Animated gif problem :/ |
|
|
Look up View.Update. It reduces flickering if you are drawing the image but im not sure if it will work with imported pictures. It doesn't hurt to try tho ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
m3mb3r
|
Posted: Tue May 29, 2012 9:32 pm Post subject: RE:Animated gif problem :/ |
|
|
ty for the reply's but i already read all of those and i just couldn't get it to work. Tony i know you are really good, and im pretty sure people have used this method and someone must have done it. So i'm just asking for the small fix because i really need it, thank you. |
|
|
|
|
![](images/spacer.gif) |
jr5000pwp
|
Posted: Tue May 29, 2012 10:27 pm Post subject: Re: Animated gif problem :/ |
|
|
To debug it change the code to:
code: |
var numFrames := Pic.Frames ("pic.gif")
var delayTime : int
var pics : array 1 .. numFrames of int
Pic.FileNewFrames ("pic.gif", pics, delayTime)
View.Set ("graphics:max;max;offscreenonly")
var x : int := 10
loop
put "Checkpoint 1"
View.Update
Pic.DrawFrames (pics, x, 10, picMerge, numFrames, 100, false)
put "Checkpoint 2"
View.Update
x := x + 5
end loop
|
By doing this you'll see when it finally reaches your view.update call and then you'll find the problem. To fix it, you'll want to understand why, and looking at the page tony provided you notice: "Pic.DrawFrames returns once all the images have been displayed". Thus meaning that it draws all of the frames then continues with the program. There may be a better solution, but what I'd do is manually animate the frames, you have your pics array of images, so just draw them manually. |
|
|
|
|
![](images/spacer.gif) |
m3mb3r
|
Posted: Thu May 31, 2012 6:21 pm Post subject: RE:Animated gif problem :/ |
|
|
it is drawing both pictures but its not showing one. Its only showing the closed mouth not the opened one, but when i end the program by cliking close it will show it. :/
can someone just try it with a gif of 2 pics? Thanks for the help! |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu May 31, 2012 7:03 pm Post subject: RE:Animated gif problem :/ |
|
|
jr5000pwp has the right idea. What is wrong with
code: |
View.Set("offscreenonly")
loop
put "one"
cls
put "two"
cls
put "three"
View.Update
delay(1000)
end loop
|
Pic.DrawFrames suffers from the same problem. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|