动画在独立的SVG(与ECMAScript中(和jQuery?)) [英] Animation in stand alone SVG (with ecmascript (and jQuery?!))

查看:104
本文介绍了动画在独立的SVG(与ECMAScript中(和jQuery?))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Inkscape创作的SVG,现在我想根据一些逻辑,以它来添加一些动画。

I created an SVG using inkscape and now I want to add some animation according to some logic to it.

我了解JavaScript的很好,用jQuery基本经验。所以我想我可以动画我与jQuery SVG为好。

I know JavaScript quite well and have basic experience with jQuery. So I thought I can animate my SVG with jQuery as well.

谷歌上找到如何使用嵌入在XHTML联SVG工作无数的教程,但我有一个独立的SVG和Firefox抱怨

Google finds countless tutorials on how to work with inline SVG embedded in XHTML, but I have a stand-alone SVG and Firefox complains

错误:b.style未定义

Error: b.style is undefined

。源文件:[......]的jquery.js

Source File: [...]jquery.js

行:16

有没有办法让jQuery的工作吗?或者,作为替代,你可以另外推荐JavaScript库我可以使用,满足的目的?

Is there a way to get jQuery working? Or, as an alternative, can you recommand another JavaScript library I could use that fulfills the purpose?

推荐答案

我会建议尝试拉斐尔库。该API是由jQuery的启发,所以应该很熟悉。

I would recommend to try the Raphaël library. The API was inspired by jQuery so it should be familiar to you.

另外要记住,IE不支持这样具有唯一SVG的解决方案将不会在主流浏览器的便携式SVG。拉斐尔需要照顾它为你 - 它在IE和SVG的其他浏览器使用VML。它适用于Firefox 3.0以上版本,Safari浏览器3.0+ 5.0+铬,歌剧9.5+和Internet Explorer 6.0 +

Also keep in mind that IE doesn't support SVG so having an SVG-only solution won't be portable across major browsers. Raphaël takes care of it for you - it uses VML on IE and SVG on other browsers. It works on Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+.

您可以使用Inkscape中创建SVG,然后导入路径到你的拉斐尔code。请参见由梅德Baranovskiy会谈于2010年JSConf 的。

You can create SVG using Inkscape and then import the paths to your Raphaël code. See the talk by Dmitry Baranovskiy at JSConf 2010.

这篇关于动画在独立的SVG(与ECMAScript中(和jQuery?))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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