我和他们一起工作并且我理解代码,但是动画效果和过渡效果之间的差异不是。
我认为动画效果只是样式上的即时动画? 过渡效果嗯,只是控制动画开始和结束后的不同时间点?
感谢您的帮助,但我在 W3C、其他论坛、mozilla 文档上阅读过,但我不明白它们之间的区别。
最佳答案
Animations can repeat any number of times
Animations can be specified to go in a forward and reverse direction
Animations can have any number of defined intermediate steps, called “keyframes”, but transitions only have a defined start and end “keyframes”.
With transitions we can specify an animation for any property which changes, using the all keyword. With animations, we need to specify every property we want animated.
过渡:从一个阶段到另一个阶段的移动,带有一些 css 属性。它也有持续时间
过渡是在变化之间发生的动画。在 CSS3 之前,当网页上的元素发生变化时,它要么处于一种状态,要么处于另一种状态。例如,如果将鼠标悬停在按钮上时它会发生变化,它从关闭状态开始到打开状态结束。您可以将任何 CSS 属性从一种状态转换为另一种状态。这意味着可以创建运动效果(通过在一个位置和另一个位置之间转换)、模糊效果(通过转换颜色)等等。
关于html - CSS 上的动画和过渡效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22957617/