CSS animation doesn't restart when resetting class

后端 未结 8 1269
陌清茗
陌清茗 2020-12-01 14:58

I am using CSS shader + animation. My shader class is defined as follows:

.shader{
-webkit-filter :custom(url(v.vs) mix(url(f.fs) multiply destination-over),         


        
相关标签:
8条回答
  • 2020-12-01 15:45

    I'd be happy to hear any criticism with my method using requestAnimationFrame as I don't see anyone else using it:

    element.classList.add("class");
    window.requestAnimationFrame(() => element.classList.remove("class"));
    
    0 讨论(0)
  • 2020-12-01 15:51

    I think I figured it out. According to this, css animation can't get applied to the same node twice (even if you have a different animation!). So I had to clone the node, remove the original, and add back the cloned node.

    0 讨论(0)
提交回复
热议问题