gpt4 book ai didi

html - 如何停止我的动画

转载 作者:太空宇宙 更新时间:2023-11-04 15:10:11 25 4
gpt4 key购买 nike

我希望 block 从一个点移动到另一个点。在 Fiddle 中,您可以看到在动画之后, block 返回到它的第一个位置。

我怎样才能避免这种情况?

http://jsfiddle.net/2nT2S/

CSS

div
{
width:100px;
height:100px;
background:black;
position:relative;
animation:myfirst 2s;
-webkit-animation:myfirst 2s; /* Safari and Chrome */
}

@keyframes myfirst
{
from { left:0px; top:0px; }
to { left:0px; top:200px; }
}

@-webkit-keyframes myfirst /* Safari and Chrome */
{
from { left:0px; top:0px; }
to { left:0px; top:200px; }
}
</style>

最佳答案

只需添加 forwards animation-fill-mode到动画:

animation:myfirst 2s forwards;
-webkit-animation:myfirst 2s forwards; /* Safari and Chrome */

jsfiddle

关于html - 如何停止我的动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20747526/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com