webkit transforms: how to roate on Z axis, but not around center?

扶醉桌前 提交于 2019-12-19 09:43:39

问题


Any idea how to get the webkit transform rotation to rotate around a point different that the center of the element (e.g. around the top right corner)?


回答1:


You can use transform-origin to change the position of the origin :

.myClass{

    -webkit-animation-duration: 1s;

    -webkit-animation-name: myAnim;

    -webkit-animation-iteration-count: infinite;

    -webkit-transform-origin: 275px 150px;

    -webkit-animation-timing-function: linear;
}

You just have to use a rotation to see it in action now :)

Here is the official documentation about it : http://www.w3.org/TR/css3-3d-transforms/#transform-origin-property




回答2:


Can you translate the object first, then rotate it?

i.e. if the center of the object is at the origin and the top-right corner is at 3,5 then translate the object -3,-5 such that the top-right corner is now at the origin. Then rotate the object as normal.



来源:https://stackoverflow.com/questions/4443750/webkit-transforms-how-to-roate-on-z-axis-but-not-around-center

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!