Can anyone provide the basic JavaScript code lines to display an existing 'Animated GIF' in SL2, including the control to play it ONCE then stop on the final frame and to control the speed of playback?
(SL2 continuously loops the animated GIF if I simply insert it as a 'Picture'.)
I've just tried this and the (3 second duration) animated gif keeps playing even when the layer is displayed. So I put in a trigger on the base layer to pause the timeline at 1 second and still the gif keeps looping!
Rather than having another image on the stage you could have another state on the gif that is a static image of the last frame then change the state of the gif to that one.
Ive had the same issue with gifs not doing as they're told, and in HTML5 my gifs just do not appear at all (not sure if this is a known issue or just something with my files)
I know animated gifs have been an issue we reported to our QA team in that the frame rate is not respected upon publish as it's published as an SWF file. I don't have any additional information to share at this point, but will include this thread in the report that we have open with our team so that I can share additional information with you once available.
Thank you all for your suggestions. Changing the state of the animated gif at a cue point does then display my 'last frame' png image, but the animated gif (the 'normal' state) also keeps on looping, even if I pause the timeline at the same cue point.
SL is completely ignoring the ('play once and stop') setting I made when I created this animated gif in Adobe 'ImageReady'.
SL needs fixing.
But to go back to my initial posted question: 'Can anyone provide the basic JavaScript code lines to display an existing 'Animated GIF' in SL2'?
As you will have gathered, I am not a JavaScript programmer but there must be a simple way to do this?
If I called it as web object, how exactly would I do this?
Sorry Tim, There is no javascript solution. If you want to embed as a web object add it to simple web page with your gif embedded saved to your desktop (or anywhere on your machine) as index.html. Then insert a web object, navigate to your webobject and insert, all the necessary files will be attached to the project when you publish.
Thanks Darren. I downloaded the test.story and can see what you're doing. It works well and your 'Normal' state animated gif stops playing and disappears at cue point no.1.
Here's my very crude animated gif test file, generated from a png in ImageReady. If I open this file in a browser, it plays once and stops on the last frame, as it should.
I suppose the most likely problem is in my animated gif.
Have a look at this Tim and see if it is what you need.
Ive created a .story file with your original gif, taken the last frame of it and saved it as a new image and created a new state in the gif when imported in SL2
Tim, just a thought are you using one of the built in states? All the built in states use Normal as their base, if you add a custom state then when you change the image, normal is not the base. I could be way off here.
Just tried that Tim as that sounds like a credible explanation.
In my solution to Tim earlier I used a custom state
I just tried it again. i put a static image in the 'disabled' state, trigger to change state at cue point. Storyline behaved itself and changed to the static image as I had hoped.
Brilliant! That was it - I made a new (non built-in) state to run the animation as 'Initial' then switched state to my 'stopped' state at the cue point and the initial animation disappears. Perfect - thank you both very much.
Wahoo! Thanks for that update Tim and I'm always impressed by the help of others here in the forums. Thanks to Darren and Phil for figuring out this mystery.
Glad you got it sorted Tim, I think just be aware (instead of beware) of the way states were intended to work, I think selected and Disabled are the two states that do not work in an advice fashion from normal, and custom states do not at all.
Add this additive 'feature' can be very useful at times or a pain in the...
18 Replies
Thanks Matthew,
I've just tried this and the (3 second duration) animated gif keeps playing even when the layer is displayed. So I put in a trigger on the base layer to pause the timeline at 1 second and still the gif keeps looping!
Thanks Matthew,
It is odd isn't it? I can see that would work but it's quite tedious!
Rather than having another image on the stage you could have another state on the gif that is a static image of the last frame then change the state of the gif to that one.
Ive had the same issue with gifs not doing as they're told, and in HTML5 my gifs just do not appear at all (not sure if this is a known issue or just something with my files)
Depending upon your usage of the animated .gif, embedding it as a web object may work better. I realize there are limitations with this too though.
Hi all,
I know animated gifs have been an issue we reported to our QA team in that the frame rate is not respected upon publish as it's published as an SWF file. I don't have any additional information to share at this point, but will include this thread in the report that we have open with our team so that I can share additional information with you once available.
Thank you all for your suggestions. Changing the state of the animated gif at a cue point does then display my 'last frame' png image, but the animated gif (the 'normal' state) also keeps on looping, even if I pause the timeline at the same cue point.
SL is completely ignoring the ('play once and stop') setting I made when I created this animated gif in Adobe 'ImageReady'.
SL needs fixing.
But to go back to my initial posted question: 'Can anyone provide the basic JavaScript code lines to display an existing 'Animated GIF' in SL2'?
As you will have gathered, I am not a JavaScript programmer but there must be a simple way to do this?
If I called it as web object, how exactly would I do this?
Sorry Tim I dont have a JS for your solution. I have uploaded a demo .story file with my gif to illustrate how mine work.
The normal state is my animated gif. Jump, Stopping and Stopped are static png files
In the story file, normal state runs until it reaches cue point 1 at 5 seconds then I have a trigger that changes state to Stopping.
At cue point 2 state changes once more to Stopped
Timeline stops at cue point 3.
Tim, can you upload your GIF and I'll have a look to see how yours differs to mine
Sorry Tim, There is no javascript solution. If you want to embed as a web object add it to simple web page with your gif embedded saved to your desktop (or anywhere on your machine) as index.html. Then insert a web object, navigate to your webobject and insert, all the necessary files will be attached to the project when you publish.
Thanks Darren. I downloaded the test.story and can see what you're doing. It works well and your 'Normal' state animated gif stops playing and disappears at cue point no.1.
Here's my very crude animated gif test file, generated from a png in ImageReady. If I open this file in a browser, it plays once and stops on the last frame, as it should.
I suppose the most likely problem is in my animated gif.
Thanks Phil, I'll try that.
Have a look at this Tim and see if it is what you need.
Ive created a .story file with your original gif, taken the last frame of it and saved it as a new image and created a new state in the gif when imported in SL2
Thanks a lot for your help Darren, it works fine. Mine still doesn't though. Is the animated gif you sent the same as the one I sent?
No worries Tim, glad I could help.
yes, the gif is the one you uploaded here. I made no changes to that, very strange!!
Tim, just a thought are you using one of the built in states? All the built in states use Normal as their base, if you add a custom state then when you change the image, normal is not the base. I could be way off here.
Just tried that Tim as that sounds like a credible explanation.
In my solution to Tim earlier I used a custom state
I just tried it again. i put a static image in the 'disabled' state, trigger to change state at cue point. Storyline behaved itself and changed to the static image as I had hoped.
The mystery continues!!
Brilliant! That was it - I made a new (non built-in) state to run the animation as 'Initial' then switched state to my 'stopped' state at the cue point and the initial animation disappears. Perfect - thank you both very much.
So - beware 'built-in' states!
Wahoo! Thanks for that update Tim and I'm always impressed by the help of others here in the forums. Thanks to Darren and Phil for figuring out this mystery.
Glad you got it sorted Tim, I think just be aware (instead of beware) of the way states were intended to work, I think selected and Disabled are the two states that do not work in an advice fashion from normal, and custom states do not at all.
Add this additive 'feature' can be very useful at times or a pain in the...
Depends on what you are trying to achieve.
This discussion is closed. You can start a new discussion or contact Articulate Support.