'Pausable animation in Sphinx documentation
I would like to add an animated figure (in my case a .gif) in my Sphinx documentation that only starts playing on the readers "click".
So far I managed to simply add the gif using:
.. figure:: _static/compareContourSimiSol0d20abd8ca_Animation.gif
But the gif runs continuously... Is it possible to click to play or pause the gif? Or should I add the animation as a vide0?
I looked a bit in using some raw html as suggested here (https://christianheilmann.com/2020/07/16/a-css-only-click-to-animate-gif-solution/) :
.. raw:: html
<label class="click-to-gif" title="click to show gif" background="_static/SimiSolTestExample.png">
<input type="checkbox">
<img src="_static/compareProfileSimiSol0d20abd8ca_Animation.gif">
</label>
And I also added this to my css file:
label.click-to-gif {
display: block;
float: left;
background: DimGrey no-repeat center center;
background-image: url('data:image/svg+xml;
...
fill="LightGrey"/>') ;
}
It kind of works but then when paused I see a big pause button (the image specified in background-image of the css). I would like to replace this pause button by an image of my choice (which is different for each animation.
Any idea how to do this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
