【问题标题】:Auto multiple animation rotate with continuously from slow rotate till to fastest rotate in the css at once call on/off onclick of an element?自动多个动画旋转,从慢速旋转到在css中最快旋转一次调用元素的onclick onclick?
【发布时间】:2020-04-20 13:13:32
【问题描述】:

这是我在this link 上所做的主题的更详细描述。我在 css 上制作了 3 个动画,它们是“animate1(作为慢速旋转)、animate2(作为中等旋转)和 animate3(作为最快的旋转)”,它们会自动连续重复,而不是快速地点击它们想要通过在“<h1>”的元素上打开/关闭 onClick 来立即运行。到目前为止,我从我的成就中所知道的只是为了运行它们直到 animate2。之后我不知道如何弄清楚这一切?请任何人接受并帮助解决此案,并对我的英语较差感到抱歉...

https://jsfiddle.net/bxeg3j2f
Fiddel 的演示通过正确的动画延迟时间安排取得了巨大的成就。
https://jsfiddle.net/cwp1hz34/2/
Fiddel 的演示在多动画位置的正确位置上取得了巨大成就。

【问题讨论】:

  • 将代码发布为minimal reproducible example。顺便说一句“......不是用他们快速点击” whuh?
  • @zer00ne 呵呵……因为我的缺乏,我很伤心。如果你不介意你纠正我,我应该怎么写在那里?增加我的英语学习。欢呼;D

标签: css animation css-animations autorotate


【解决方案1】:

不太确定你想要什么。只是想猜测一下......

.test {
    font-size: 50px;
    background-color: lightblue;
    animation: rotate linear 6s infinite;
    display: block;
    width: 50px;
}

@keyframes rotate {
  0% {transform: rotate(0deg)}
  33% {transform: rotate(360deg)}
  66% {transform: rotate(1080deg)}
  100% {transform: rotate(7200deg)}

}


Another possible approach, making the speed increase smoother:
<div class="test">A</div>

.test {
    font-size: 50px;
    background-color: lightblue;
    display: block;
    width: 35px;
    padding: 0px 14px;
    animation: rotate 6s infinite;
    animation-timing-function: cubic-bezier(.59,.07,.88,.64);
}

@keyframes rotate {
  0% {transform: rotate(0deg)}
  100% {transform: rotate(1800deg)}
}
<div class="test">A</div>

【讨论】:

  • 是的。你做到了。你真的明白我想要什么感谢@vals 非常非常感谢。但是直到今天我们仍然不能将3个动画合二为一吗?
  • 很高兴它对您有所帮助。但现在,我不明白你的评论。这是一部动画,不是三部。你想让速度的提升更顺畅吗?
  • 是的,在这种情况下你是对的,你的解决方案比我的解决方案更伟大更简单,这非常复杂,而且需要太多的行。但在我的任何情况下,我还有其他任何情况,即三个动画必须组合成一个......
猜你喜欢
  • 2020-07-27
  • 2015-10-07
  • 2011-03-23
  • 1970-01-01
  • 1970-01-01
  • 2013-09-02
  • 2021-02-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多