198
Views
11
Comments
Why does my GIF not play every time it appears?
Question

The first time my GIF appears, it plays. Subsequently, it appears, but remains static (as if played). Sometimes, when an input leading up to the GIF appearance is different, it plays again. What may cause this behavior?


Thanks!

2023-07-28 17-00-32
Marco Arede
 
MVP

Hi YS Yeo,

(Edit: thanks for your observation Kilian Hekhuis)

An alternative to the solution assif_tiger wrote here, you could also use an external image editing program, to change the GIF's looping settings. 

For example in Photoshop open the gif, go to the Window tab and select timeline, set option "Forever".

I hope this helps, regards!


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

@Marco: I think the OP means an animated GIF not playing, not that it repeats across the page ;)

2021-04-09 11-42-43
assif_tiger
 
MVP

YS Yeo wrote:

The first time my GIF appears, it plays. Subsequently, it appears, but remains static (as if played). Sometimes, when an input leading up to the GIF appearance is different, it plays again. What may cause this behavior?


Thanks!

Hi,

you can also add a ?+Math.random() to the end of the picture src and it'll reload the .gif.

img.src = "your_image_url.gif"+"?a="+Math.random();
2019-08-31 06-59-55
YS

Thanks! Where do I put +"?a="+Math.random()?

Here?:

2018-09-27 18-20-33
Swatantra Kumar
Champion

YS Yeo wrote:

Thanks! Where do I put +"?a="+Math.random()?

Here?:

RuntimePath is a variable. Add below to append the variable. So in the code where you're calling the variable, just append it.

+"?a="+Math.random();



2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Swatantra,

Runtime Path is not editable, so your suggestion is invalid. Also, Math.random() is JavaScript, you can't add JavaScript to a Property like that!

2018-09-27 18-20-33
Swatantra Kumar
Champion

Kilian Hekhuis wrote:

Hi Swatantra,

Runtime Path is not editable, so your suggestion is invalid. Also, Math.random() is JavaScript, you can't add JavaScript to a Property like that!


This is what I've mentioned, RuntimePath is a variable. While Math.random() is a javascript, so it has to be appended where variable is being called. 

2020-02-28 09-46-54
Eduardo Jauch

Hi Swatantra,

Kilian was pointing that the image posted by the OP is of the properties of the gif, under the Images folder in the Interface tab.
You can't change this value, and it is not a variable.

You could tell to use an Image Widget with an external image and set the URL with the Math.random(). Again this would not work, because this would be interpreted as a part of the name of the image, not as a JavaScript instruction.

To do what you and Assif are proposing, you would have to use an expression and place an image tag in it, in the page. Too much trouble.

Using a gif (in an Image widget) with a looping count of 1, every time I enter the page with the GIF, it is played and stops at the end. If I open the page again, it plays one time. I tested both in Chrome and Opera.

If this is not what one wants (and you want to play the gif indefinitely, change the looping count as Marco already told at the beginning. You can do this online here: https://ezgif.com/maker

Cheers.

2019-08-31 06-59-55
YS

Thanks all for the explanations.

@Eduardo, I am not trying to make the gif play indefinitely. I want the gif to play once every time it is rendered. Sadly, it only plays the first time it is rendered for each app session.

2020-02-28 09-46-54
Eduardo Jauch

Hi YS,

1. Mobile or Web?

2. What browser or device did you test?

Cheers.

2019-08-31 06-59-55
YS

Eduardo Jauch wrote:

Hi YS,

1. Mobile or Web?

2. What browser or device did you test?

Cheers.


Mobile. Android Samsung. (:

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.