在HTML / HTML5中使用JS的不规则锚点和形状 [英] Irregular anchors and shapes using JS in HTML/HTML5

查看:405
本文介绍了在HTML / HTML5中使用JS的不规则锚点和形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在JS中的某些表面上具有不规则形状(如锚点),并且可以在页面加载时在运行时变成球?我想要制作可以是球的表面动画,并且还想跟踪哪个锚点形状处于特定点。那么有可能使用JS?任何人都可以给我一些想法,这是如何实现的?我希望有解决方案,但无法找到任何,所以任何提示,将不胜感激。有没有一些JS库。这可以帮助做到这一点?有些东西像processing.js或Raphael js?

请告诉你任何你知道的事情。



提前感谢每一个。

解决方案

我建议使用优秀的SVG Raphael js 图书馆。您可以使用纯JavaScript(即无附加插件)制作交互式动画,并且可以将这些对象制作为不规则锚点(覆盖点击 mouseover mouseout 事件来模拟锚行为)。

另一个想法是使用HTML5 canvas,但是这个需要更多的代码(技术仍然不成熟),并可能无法在不同的浏览器下工作。

Is it possible to have irregular shapes like anchors on some surface in JS that can be clickable and it becomes a ball on runtime on page loads? I want to animate that surface that can be a ball and also want to track that which anchor shape is at particular point. So is it possible using JS? Can anyone give me some idea that how can this be achieved? I hope that there will be solution but unable to find any, so any hints would be appreciated. Is there some JS lib. that can help to do this? some thing like processing.js or Raphael js?

Please tell any thing that you know about this.

Thanks in advance every one.

解决方案

I suggest using SVG with excelent Raphael js library. You can make interactive animations with pure javascript (i.e. without additional plugins) and those objects can be made irregular anchors (overriding click, mouseover and mouseout events to emulate anchor behaviour).

Another idea is to use HTML5 canvas, but this requires more code (the technology is still immature) and may fail to work under different browsers.

这篇关于在HTML / HTML5中使用JS的不规则锚点和形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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