使用不同的计时函数翻译 x 和 y?
目前,我正在使用以下代码以相同的速度平移 x 和 y:
-webkit-transition:all 180ms ease-out;
我想将 X 轴平移得比 Y 慢。是否可以指定类似以下内容:
-webkit-transition:translateX 180ms ease-out;
-webkit-transition:translateY 50ms ease-out;
提前致谢!
Currently I'm using the following code to translate both x and y at the same speed:
-webkit-transition:all 180ms ease-out;
I would like to translate the X axis slower than the Y. Is it possible to specify something similar to:
-webkit-transition:translateX 180ms ease-out;
-webkit-transition:translateY 50ms ease-out;
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
悲伤但却是事实:您不能对
transform
的不同部分使用不同的计时,因为它现在只是一个属性并且无法拼接。您唯一可以做的事情是:
translate
,并对另一个轴使用定位(例如top
或left
)。这样做您可以附加不同的时间。我们没有其他办法:(
Sad but true: you can't use different timings for different parts of
transform
since it's now only one property and cannot be spliced.The only things you can do:
translate
only for one axis, and use the positioning for another (liketop
orleft
). Doing so you could attach different timings.transform
s on them. It would take more code, but would be helpful if you'll need the GPU acceleration.No other ways for us :(
并不理想,但您可以转换一个维度并更改另一个属性,例如另一个维度上的
left
...演示 http://jsfiddle.net/DFLL7/
Not ideal, but you could translate one dimension and change another property, such as
left
on the other...Demo http://jsfiddle.net/DFLL7/
我不确定,但也许你可以尝试一下。
I'm not sure, but maybe you can try.