如何顺时针旋转物体? [英] How to rotate an object clockwise?

查看:96
本文介绍了如何顺时针旋转物体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何顺时针旋转对象(没有画布,css3等)?



请参阅我的示例代码



帮助纠正我的公式。

解决方案

如果没有CSS,你不能这样做,但是你的示例代码使用CSS进行翻译:你通过使用JavaScript修改div的样式属性来修改CSS属性。 / p>

尝试类似:

  div.style [' -  webkit- transform'] ='rotate('+ angle +'deg)'; 

设置角度,假设您正在使用Webkit浏览器。


How to rotate an object clockwise (without canvas, css3 etc)?

Please see my example code

Just help to correct my formula.

解决方案

You can't do it without CSS, but your example code is using CSS for the translation: you're modifying CSS properties by using JavaScript to modify the div's style property.

Try something like:

div.style['-webkit-transform'] = 'rotate(' + angle + 'deg)';

To set the angle, assuming you are working with a Webkit browser.

这篇关于如何顺时针旋转物体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆