3d 中的 z
任何人都可以解释或给我指出一个使用 translate3d
(webkit 转换)中的“z”的示例吗?我已成功使用 translate3d(x,y,0)
在移动 Safari 上获取硬件加速的 2D 动画,但现在我尝试使用 z 参数进行缩放,但它似乎没有任何效果效果...
elem.style.WebkitTransform = 'translate3d(100px,0,0)'; // this works as expected
elem.style.WebkitTransform = 'translate3d(0,0,100)'; // nothing happens
elem.style.WebkitTransform = 'translate3d(0,0,100px)'; // nothing happens
elem.style.WebkitTransform = 'scale(1.2, 1.2)'; // works but slow on ios
旁注:我正在尝试构建一个可以在 ios 上顺利运行的小型缩放脚本。
Can anyone explain or point me to an example where the "z" in translate3d
(webkit transform) is being used? I have successfully used translate3d(x,y,0)
to get hardware accelerated 2D animations on mobile Safari, but now I’m trying to scale using the z parameter, but it does not seem to have any effect...
elem.style.WebkitTransform = 'translate3d(100px,0,0)'; // this works as expected
elem.style.WebkitTransform = 'translate3d(0,0,100)'; // nothing happens
elem.style.WebkitTransform = 'translate3d(0,0,100px)'; // nothing happens
elem.style.WebkitTransform = 'scale(1.2, 1.2)'; // works but slow on ios
Sidenote: I’m trying to build a small zoom script that works smoothly on ios.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请记住在包含框上设置 -webkit-perspective。 800 是一个不错的起始值。如果盒子消失了,缩小它,它可能比视口大。
Surfin' Safari 博客有一篇 3d 变换首次发明时的文章:
更多信息请参见:http://www.webkit.org/blog/386/3d-transforms /
Remember to set the -webkit-perspective on the containing box. 800 is a good starting value. If the box disappears, reduce it, it's probably bigger than the viewport.
The Surfin' Safari blog has an article from when 3d transforms were first invented:
More here: http://www.webkit.org/blog/386/3d-transforms/
我制作这个是为了向您展示 webkit 3D 变换的工作原理:
http://jsbin.com/iderag
希望对您有帮助。我猜您的
body
或父标记中没有-webkit-perspective
。I made this for you to show how webkit transform 3D works:
http://jsbin.com/iderag
I hope it help you. I'm guessing you don't have
-webkit-perspective
in yourbody
or parent tag.