简体   繁体   English

如何在css中重新启动组动画?

[英]How to restart group animations in css?

How to restart group animations in css?如何在css中重新启动组动画? I need to run them again, applying the delays.我需要再次运行它们,应用延迟。 Meaning when zoomersout is done it will run the zoomers1 (including the 2s delay) from the start.这意味着当zoomersout完成后,它将从一开始就运行zoomers1 (包括 2s 延迟)。

I tried to use infinite but what happens is it zooms every 1s.我尝试使用无限,但结果是它每 1 秒放大一次。 The delay runs once only....延迟只运行一次......

how to make this if possible?如果可能的话,如何做到这一点?

css css

.letter1{
    color:#74ee76;
    animation: zoomers1 1s ease-in-out forwards,zoomersout 1s ease-in 1s forwards;
}

.letter2{
    color:#7674ee;
    animation: zoomers2 1s ease-in-out 1s forwards,zoomersout 1s ease-in 2s forwards;;
}

@keyframes zoomers1 {
    from {
        z-index: 100;
        scale: 1;
    }

    to {
        font-size:1000px;
        scale: 1;
        z-index: 0;
    }
}

@keyframes zoomers2 {
    from {
        z-index: 200;
        scale: 0;
    }

    to {
        font-size:1000px;
        z-index: 0;
        scale: 1;
    }
}
@keyframes zoomersout {
    from {
        font-size:1000px;
        z-index: 0;
        scale: 1;
    }

    to {
        font-size:1000px;
        z-index: 0;
        scale: 100;
    }
}

html html

<div class="lett letter1" style="position:absolute" >F</div>
<div class="lett letter2" style="position:absolute" >R</div> 

example i wish to happen...我希望发生的例子...

rerun(){
    run-> animations in letter1 after animations letter2 is done
    run-> animations in letter2 after animations letter1 is done
}

Not sure how is this possible in css/javascript/jquery... Appreciate any solution... Thanks!不知道这在 css/javascript/jquery 中怎么可能......感谢任何解决方案......谢谢!

You have to set your .letter1 animation style to "none".您必须将.letter1 animation样式设置为“无”。

Example below :下面的例子:

var myelement = document.getElementByClassName("letter1");
myelement.style.animation = "none";
myelement.style.offsetHeight; //now set offset

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM