Rotating an image in all browsers (canvas in IE?)

纵饮孤独 提交于 2019-12-07 18:25:50

问题


I finally got to work with canvas only to find out that it is not implemented in IE. I tried explore canvas from google to use it in Internet Explorer, but it's not working for my code (http://uptowar.com/test.php - little bug though that it is not removing the old image when rotating).

So, is there an other way to smoothly rotate an image around it's bottom center angle? Maybe javascript? Or is there a way to do it with IE and canvas anyway?

Edit: Google Chrome also seems to add an ugly border to the canvas example.. there must be an other smooth way?

Edit2: tried a hacky javascript way: it causes mayor lags and corrupts the image (http://uptowar.com/test2.php), anyone knows of a working method?


回答1:


RaphaelJS is a great cross-browser JavaScript library that might do exactly what you need. I highly recommend it. If you visit the site there is even a specific example that involves rotating an image.




回答2:


perhaps just use an animated .gif file

Flash is another alternative if you want more control.




回答3:


There are some frameworks (eg. Dojo) offering a cross-browser drawing interface. They use canvas on most browsers, and VML on IE flavors. VML is Vector Markup Language, a kind of proprietary ancestor of SVG.

I searched svg vml library in Google and was surprised there are lot of libraries, apparently.



来源:https://stackoverflow.com/questions/365532/rotating-an-image-in-all-browsers-canvas-in-ie

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