要用于转换的过渡属性是什么?

问题描述 投票:7回答:2

我不确定这是否正确,但我想旋转一个元素,而且我知道transform: rotate(90deg)transition-property:all可以工作,但是我不想转换转换的all。我应该使用什么transition-property,并且有更好的方法来创建旋转动画?

css css-transforms
2个回答
22
投票
-webkit-transition-property: -webkit-transform; -moz-transition-property: -moz-transform; -ms-transition-property: -ms-transform; -o-transition-property: -o-transform; transition-property: transform;

2
投票
@keyframes rotateDiv { from { transform: rotateZ(0deg); } to { transform: rotateZ(360deg); } } div { animation-name: rotateDiv; animation-duration: 1s; animation-timing-function: linear; /* For a steady rate loop */ animation-delay: 0s; animation-iteration-count: infinite; /* Use actual numbers for limited repeat */ }
© www.soinside.com 2019 - 2024. All rights reserved.