如何在Javascript或CSS中旋转图像 [英] How do I rotate an image in Javascript or CSS

查看:90
本文介绍了如何在Javascript或CSS中旋转图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个简单的游戏。

I am creating a simple game.

我想使用jQUERY旋转关节使其移动。我正在使用.animate( http://api.jquery.com/animate/ )进行动画制作CSS属性,但如果也可以使用Javscript,我可以自己创建自定义代码。

I want to use jQUERY to rotate the joints making it move. I am using .animate ( http://api.jquery.com/animate/ ) to animate CSS properties but if it is also possible to use Javscript, I can make my own custom code.

更多点对点

如何在CSS或Javascript中旋转图像?我更喜欢CSS,但Javascript也很好。

How do I rotate images in CSS or Javascript? I prefer CSS but Javascript is fine too.

如果不可能(我很确定它是但我还没有放弃)还有其他可行的方法要做我想做的事情而不制作一堆单独的图像,每个都以不同的方式旋转。
或者任何人都可以至少给我一个做类似事情的网站的例子。

If it is impossible (which I am pretty sure it is but I am not giving up yet) is there any other possible way to do what i am trying to do without making a bunch of seperate images, each rotated a different way. Or can anyone at least give me an example of a site that does something similar.

编辑:我需要1个CSS属性(no -something:rotation( 500deg);)适用于 FireFox Safari Chrome ,因为这些是我真正合作的唯一浏览器。

I need 1 CSS property (no -something: rotation(500deg);) that works with FireFox, Safari and Chrome because those are the only browsers I really work with.

推荐答案

Firefox和Webkit浏览器支持转换CSS属性(-webkit-transform, - moz-transform) 。那些可以做各种有趣的事情。有一个非常弱的IE工具允许非常有限的旋转,所以它不是像游戏这样的选项。

Firefox and the Webkit browsers support a "transform" CSS property ("-webkit-transform", "-moz-transform"). Those can do all sorts of interesting things. There's a very weak IE tool that allows very limited rotation, so it's not really an option for something like a game.

这是我为另一个Stackoverflow问题做的演示页面几天前: http://gutfullofbeer.net/compass.html

Here's a demo page I made for another Stackoverflow question a few days ago: http://gutfullofbeer.net/compass.html

这篇关于如何在Javascript或CSS中旋转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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