mayognaise / aframe-gif-component

A conponent to control GIF for A-Frame VR.
https://mayognaise.github.io/aframe-gif-component/basic/index.html
MIT License
24 stars 5 forks source link

Gif controls #7

Open IlaRistola opened 6 years ago

IlaRistola commented 6 years ago

It seems that I cannot control gif from begin. Photoshop created gif loop forever, even if it set to loop only once(tested 2 loop too) in PS. Play/pause/tooglePlayback not have effect on begin of the script, but when i use controls after click event, or mouse enter etc. controls work. But anyway problem is that looping is un-controlled before first click on look event. I also tried make own function for controlling, but no lucky. Of course there is way to trick it, with change src when click or look event happen, so i can control it from first frame. But of course it is much easier to control it from start. Some entity.reset() can also help there probably.. I feel gif's is so tricky :D Any thoughts?

jrDev1 commented 4 years ago

I agree with adding a control that restarts the gif. To solve this, what I did though was remove and readd the material. I use this specifically in the marker lost event but you can add this to buttons.

document.querySelector('#MainGIF').removeAttribute('material'); document.querySelector('#MainGIF').setAttribute('material', { shader: "gif", src: "#my-gif" });